try enqueue accounts in a loop instead

This commit is contained in:
Andre Medeiros 2022-05-27 14:47:59 -04:00
parent fb3f2d1433
commit 9b5829f549

View file

@ -92,7 +92,13 @@ func SchedulerCmd(ctx context.Context) *cobra.Command {
}
s := gocron.NewScheduler(time.UTC)
_, _ = s.Every(100).Milliseconds().SingletonMode().Do(func() { enqueueAccounts(ctx, logger, statsd, db, redis, luaSha, notifQueue) })
go func() {
for {
enqueueAccounts(ctx, logger, statsd, db, redis, luaSha, notifQueue)
time.Sleep(100 * time.Millisecond)
}
}()
//_, _ = 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) })