diff --git a/cmd/apollo-scheduler/main.go b/cmd/apollo-scheduler/main.go index 97d5305..105f461 100644 --- a/cmd/apollo-scheduler/main.go +++ b/cmd/apollo-scheduler/main.go @@ -120,11 +120,8 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.P SELECT id FROM accounts WHERE - ( - (last_checked_at + 5) >= $1 AND - (last_checked_at + 5) < $2 - ) - OR last_checked_at + 60 < $1 + (last_checked_at + 5) BETWEEN $1 and $2 + OR last_checked_at + 60 <= $1 ORDER BY last_checked_at ) UPDATE accounts @@ -153,6 +150,8 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.P logger.WithFields(logrus.Fields{ "count": len(ids), + "start": start, + "end": end, }).Debug("enqueueing account batch") enqueued := 0 @@ -177,6 +176,8 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.P logger.WithFields(logrus.Fields{ "count": enqueued, "skipped": skipped, + "start": start, + "end": end, }).Info("done enqueueing account batch") } diff --git a/cmd/apollo-worker-notifications/main.go b/cmd/apollo-worker-notifications/main.go index 9658ff9..ecc389a 100644 --- a/cmd/apollo-worker-notifications/main.go +++ b/cmd/apollo-worker-notifications/main.go @@ -126,7 +126,7 @@ func main() { } numConsumers := runtime.NumCPU() * 12 - prefetchLimit := int64(numConsumers * 8) + prefetchLimit := int64(numConsumers * 2) if err := queue.StartConsuming(prefetchLimit, pollDuration); err != nil { panic(err)