fix logic again

This commit is contained in:
Andre Medeiros 2021-07-08 21:20:49 -04:00
parent 09c42c379c
commit 26a034a68b
2 changed files with 7 additions and 6 deletions

View file

@ -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")
}

View file

@ -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)