mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-14 16:07:42 +00:00
fix batches
This commit is contained in:
parent
1617bf88e1
commit
bb2f709259
1 changed files with 4 additions and 9 deletions
|
@ -377,11 +377,11 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
|
||||||
}
|
}
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var ids []int64
|
var ids []string
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var id int64
|
var id int64
|
||||||
_ = rows.Scan(&id)
|
_ = rows.Scan(&id)
|
||||||
ids = append(ids, id)
|
ids = append(ids, fmt.Sprintf("%d", id))
|
||||||
}
|
}
|
||||||
|
|
||||||
enqueued := 0
|
enqueued := 0
|
||||||
|
@ -411,7 +411,7 @@ 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)))
|
||||||
|
|
||||||
unlocked, err := redisConn.EvalSha(ctx, luaSha, []string{"locks:accounts"}, batch).Int64Slice()
|
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))
|
||||||
}
|
}
|
||||||
|
@ -423,12 +423,7 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
payloads := make([]string, len(unlocked))
|
if err = queue.Publish(unlocked...); err != nil {
|
||||||
for i, id := range unlocked {
|
|
||||||
payloads[i] = fmt.Sprintf("%d", id)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = queue.Publish(payloads...); 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