mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-29 07:07:42 +00:00
run scheduler 5 times per second
This commit is contained in:
parent
cbcab2a992
commit
424e27b068
1 changed files with 2 additions and 2 deletions
|
@ -67,7 +67,7 @@ func SchedulerCmd(ctx context.Context) *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
s := gocron.NewScheduler(time.UTC)
|
s := gocron.NewScheduler(time.UTC)
|
||||||
s.Every(1).Second().SingletonMode().Do(func() { enqueueAccounts(ctx, logger, statsd, db, redis, luaSha, notifQueue) })
|
s.Every(200).Milliseconds().SingletonMode().Do(func() { enqueueAccounts(ctx, logger, statsd, db, redis, luaSha, notifQueue) })
|
||||||
s.Every(1).Second().Do(func() { cleanQueues(ctx, logger, queue) })
|
s.Every(1).Second().Do(func() { cleanQueues(ctx, logger, queue) })
|
||||||
s.Every(1).Minute().Do(func() { reportStats(ctx, logger, statsd, db, redis) })
|
s.Every(1).Minute().Do(func() { reportStats(ctx, logger, statsd, db, redis) })
|
||||||
s.Every(1).Minute().Do(func() { cleanAccounts(ctx, logger, db) })
|
s.Every(1).Minute().Do(func() { cleanAccounts(ctx, logger, db) })
|
||||||
|
@ -210,7 +210,7 @@ func enqueueAccounts(ctx context.Context, logger *logrus.Logger, statsd *statsd.
|
||||||
last_enqueued_at < $1
|
last_enqueued_at < $1
|
||||||
OR last_checked_at < $2
|
OR last_checked_at < $2
|
||||||
ORDER BY last_checked_at
|
ORDER BY last_checked_at
|
||||||
LIMIT 2000
|
LIMIT 1000
|
||||||
FOR UPDATE SKIP LOCKED
|
FOR UPDATE SKIP LOCKED
|
||||||
)
|
)
|
||||||
UPDATE accounts
|
UPDATE accounts
|
||||||
|
|
Loading…
Reference in a new issue