From fb3f2d1433e35250e3975dbff4fddcaf3dc91445 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Fri, 27 May 2022 14:40:40 -0400 Subject: [PATCH] more scheduler tweaks --- internal/cmd/scheduler.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/cmd/scheduler.go b/internal/cmd/scheduler.go index 32b93fc..9c2cdd9 100644 --- a/internal/cmd/scheduler.go +++ b/internal/cmd/scheduler.go @@ -24,7 +24,7 @@ import ( ) const ( - batchSize = 1000 + batchSize = 200 maxNotificationChecks = 5000 ) @@ -92,11 +92,11 @@ func SchedulerCmd(ctx context.Context) *cobra.Command { } s := gocron.NewScheduler(time.UTC) - _, _ = s.Every(500).Milliseconds().SingletonMode().Do(func() { enqueueAccounts(ctx, logger, statsd, db, redis, luaSha, notifQueue) }) - _, _ = s.Every(500).Milliseconds().SingletonMode().Do(func() { enqueueSubreddits(ctx, logger, statsd, db, []rmq.Queue{subredditQueue, trendingQueue}) }) - _, _ = s.Every(500).Milliseconds().SingletonMode().Do(func() { enqueueUsers(ctx, logger, statsd, db, userQueue) }) - _, _ = s.Every(1).Second().Do(func() { cleanQueues(logger, queue) }) - _, _ = s.Every(1).Second().Do(func() { enqueueStuckAccounts(ctx, logger, statsd, db, stuckNotificationsQueue) }) + _, _ = s.Every(100).Milliseconds().SingletonMode().Do(func() { enqueueAccounts(ctx, logger, statsd, db, redis, luaSha, notifQueue) }) + _, _ = s.Every(5).Second().Do(func() { enqueueSubreddits(ctx, logger, statsd, db, []rmq.Queue{subredditQueue, trendingQueue}) }) + _, _ = s.Every(5).Second().Do(func() { enqueueUsers(ctx, logger, statsd, db, userQueue) }) + _, _ = s.Every(5).Second().Do(func() { cleanQueues(logger, queue) }) + _, _ = s.Every(5).Second().Do(func() { enqueueStuckAccounts(ctx, logger, statsd, db, stuckNotificationsQueue) }) _, _ = s.Every(1).Minute().Do(func() { reportStats(ctx, logger, statsd, db) }) _, _ = s.Every(1).Minute().Do(func() { pruneAccounts(ctx, logger, db) }) _, _ = s.Every(1).Minute().Do(func() { pruneDevices(ctx, logger, db) })