fix jobs in scheduler

This commit is contained in:
Andre Medeiros 2022-11-02 01:17:54 -04:00
parent 22c80c260f
commit c8accd5618

View file

@ -290,10 +290,10 @@ func enqueueSubreddits(ctx context.Context, logger *zap.Logger, statsd *statsd.C
batchIds[i] = strconv.FormatInt(id, 10) batchIds[i] = strconv.FormatInt(id, 10)
} }
jobs := make([]*faktory.Job, len(batchIds)*2) jobs := []*faktory.Job{}
for i, id := range ids { for _, id := range ids {
jobs[i*2] = faktory.NewJob("SubredditWatcherJob", id) jobs = append(jobs, faktory.NewJob("SubredditWatcherJob", id))
jobs[i*2+1] = faktory.NewJob("SubredditTrendingJob", id) jobs = append(jobs, faktory.NewJob("SubredditTrendingJob", id))
} }
if _, err := fc.PushBulk(jobs); err != nil { if _, err := fc.PushBulk(jobs); err != nil {
logger.Error("failed to enqueue subreddit batch", zap.Error(err)) logger.Error("failed to enqueue subreddit batch", zap.Error(err))