mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 03:37:43 +00:00
get string slice straight from command result
This commit is contained in:
parent
e1b880d063
commit
80bae7ff9f
1 changed files with 5 additions and 11 deletions
|
@ -454,25 +454,19 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
|
||||||
|
|
||||||
logger.Debug("enqueueing batch", zap.Int("len", len(batch)))
|
logger.Debug("enqueueing batch", zap.Int("len", len(batch)))
|
||||||
|
|
||||||
res, err := redisConn.EvalSha(ctx, luaSha, []string{"locks:accounts"}, batch).Result()
|
unlocked, err := redisConn.EvalSha(ctx, luaSha, []string{"locks:accounts"}, batch).StringSlice()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("failed to check for locked accounts", zap.Error(err))
|
logger.Error("failed to check for locked accounts", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
vals := res.([]interface{})
|
skipped += len(batch) - len(unlocked)
|
||||||
skipped += len(batch) - len(vals)
|
enqueued += len(unlocked)
|
||||||
enqueued += len(vals)
|
|
||||||
|
|
||||||
if len(vals) == 0 {
|
if len(unlocked) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
batchIds := make([]string, len(vals))
|
if err = queue.Publish(unlocked...); err != nil {
|
||||||
for k, v := range vals {
|
|
||||||
batchIds[k] = v.(string)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = queue.Publish(batchIds...); err != nil {
|
|
||||||
logger.Error("failed to enqueue account batch", zap.Error(err))
|
logger.Error("failed to enqueue account batch", zap.Error(err))
|
||||||
}
|
}
|
||||||
}(i)
|
}(i)
|
||||||
|
|
Loading…
Reference in a new issue