mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-13 23:47:44 +00:00
handle empty candidate set for scheduling
This commit is contained in:
parent
73e7927d3f
commit
f9fd53610f
1 changed files with 9 additions and 1 deletions
|
@ -504,6 +504,15 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
|
|||
logger.Error("failed to check for locked accounts", zap.Error(err))
|
||||
}
|
||||
|
||||
if len(enqueued) == 0 {
|
||||
logger.Info("no viable candidates to enqueue",
|
||||
zap.Int("offset", offset),
|
||||
zap.Int("attempts", len(ids)),
|
||||
zap.Int("enqueued", len(enqueued)),
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if err = queue.Publish(enqueued...); err != nil {
|
||||
logger.Error("failed to enqueue account batch",
|
||||
zap.Error(err),
|
||||
|
@ -519,7 +528,6 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
|
|||
zap.Int("attempts", len(ids)),
|
||||
zap.Int("enqueued", len(enqueued)),
|
||||
)
|
||||
|
||||
}(ctx, i)
|
||||
}
|
||||
wg.Wait()
|
||||
|
|
Loading…
Reference in a new issue