mirror of
https://github.com/hibiken/asynq.git
synced 2026-01-30 17:54:23 +00:00
fix: queues map init with size (#673)
Co-authored-by: yipinhe <yipinhe@tencent.com>
This commit is contained in:
@@ -375,7 +375,7 @@ func EncodeServerInfo(info *ServerInfo) ([]byte, error) {
|
|||||||
if info == nil {
|
if info == nil {
|
||||||
return nil, fmt.Errorf("cannot encode nil server info")
|
return nil, fmt.Errorf("cannot encode nil server info")
|
||||||
}
|
}
|
||||||
queues := make(map[string]int32)
|
queues := make(map[string]int32, len(info.Queues))
|
||||||
for q, p := range info.Queues {
|
for q, p := range info.Queues {
|
||||||
queues[q] = int32(p)
|
queues[q] = int32(p)
|
||||||
}
|
}
|
||||||
@@ -400,7 +400,7 @@ func DecodeServerInfo(b []byte) (*ServerInfo, error) {
|
|||||||
if err := proto.Unmarshal(b, &pbmsg); err != nil {
|
if err := proto.Unmarshal(b, &pbmsg); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
queues := make(map[string]int)
|
queues := make(map[string]int, len(pbmsg.GetQueues()))
|
||||||
for q, p := range pbmsg.GetQueues() {
|
for q, p := range pbmsg.GetQueues() {
|
||||||
queues[q] = int(p)
|
queues[q] = int(p)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user