mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 21:27:42 +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
|
SELECT id
|
||||||
FROM accounts
|
FROM accounts
|
||||||
WHERE
|
WHERE
|
||||||
(
|
(last_checked_at + 5) BETWEEN $1 and $2
|
||||||
(last_checked_at + 5) >= $1 AND
|
OR last_checked_at + 60 <= $1
|
||||||
(last_checked_at + 5) < $2
|
|
||||||
)
|
|
||||||
OR last_checked_at + 60 < $1
|
|
||||||
ORDER BY last_checked_at
|
ORDER BY last_checked_at
|
||||||
)
|
)
|
||||||
UPDATE accounts
|
UPDATE accounts
|
||||||
|
@ -153,6 +150,8 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.P
|
||||||
|
|
||||||
logger.WithFields(logrus.Fields{
|
logger.WithFields(logrus.Fields{
|
||||||
"count": len(ids),
|
"count": len(ids),
|
||||||
|
"start": start,
|
||||||
|
"end": end,
|
||||||
}).Debug("enqueueing account batch")
|
}).Debug("enqueueing account batch")
|
||||||
|
|
||||||
enqueued := 0
|
enqueued := 0
|
||||||
|
@ -177,6 +176,8 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.P
|
||||||
logger.WithFields(logrus.Fields{
|
logger.WithFields(logrus.Fields{
|
||||||
"count": enqueued,
|
"count": enqueued,
|
||||||
"skipped": skipped,
|
"skipped": skipped,
|
||||||
|
"start": start,
|
||||||
|
"end": end,
|
||||||
}).Info("done enqueueing account batch")
|
}).Info("done enqueueing account batch")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
numConsumers := runtime.NumCPU() * 12
|
numConsumers := runtime.NumCPU() * 12
|
||||||
prefetchLimit := int64(numConsumers * 8)
|
prefetchLimit := int64(numConsumers * 2)
|
||||||
|
|
||||||
if err := queue.StartConsuming(prefetchLimit, pollDuration); err != nil {
|
if err := queue.StartConsuming(prefetchLimit, pollDuration); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in a new issue