mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-13 07:27:43 +00:00
fix logic again
This commit is contained in:
parent
09c42c379c
commit
26a034a68b
2 changed files with 7 additions and 6 deletions
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue