When does the daily task for the 'Reader' badge run?

AI-generated summary

In a support discussion titled ‘When does the daily task for the \u2018Reader\u2019 badge run?’, sweetbeems seeks to determine the exact schedule of the Reader Badge’s daily task, noting it isn’t visible in logs or crontab. They suspect it’s handled by /discourse/blob/main/app/jobs/scheduled/badge_grant.rb but lack Ruby experience. pfaffman suggests checking Sidekiq and forcing the job to run to infer its schedule. sweetbeems tries listing scheduled jobs via Sidekiq commands but finds no relevant entry, questioning if the badge job runs by default. pfaffman then directs them to visit https://yourforum.com/sidekiq to view the job dashboard. sweetbeems confirms this solved their issue, expressing gratitude. The discussion highlights that the Reader Badge task is managed via Sidekiq, not cron, and runs in UTC unless otherwise configured. Accessing the Sidekiq UI provides visibility into job schedules and execution times.

Per the solution about why users may not see a Reader Badge awarded, I was wondering how I might figure out when exactly the daily task for the Reader Badge is run?

I’ve entered my discourse app and looked at the /shared/log/rails/production.log, but I wasn’t finding much. There also doesn’t seem to be a crontab for this task. (crontab -l returns nothing relevant)

Any insight on how to figure out when it runs? And is UTC or a specific timezone? Thanks! :slight_smile:

If it helps, I think the job is scheduled in /discourse/blob/main/app/jobs/scheduled/badge_grant.rb.

I’m not experienced in ruby though, so take that with a grain of salt!

See /sidekiq and the look for the job name that your found. You can force it to run and then it’ll run the same time the next day.

I’m sorry, I’m not exactly following.. I don’t know anything about sidekiq or rails :sweat_smile:

I’ve tried to list out all the scheduled jobs in discourse:

ss = Sidekiq::ScheduledSet.new
ss.map{|job| job['args']}

=> [[{"topic_id"=>19, "current_site_id"=>"default"}],
 [{"topic_id"=>17, "current_site_id"=>"default"}],
 [{"type"=>"user_posted",
   ...
   "current_site_id"=>"default"}],
 [{"type"=>"user_replied",
  ...
   "current_site_id"=>"default"}],
 [{"post_id"=>1386, "current_site_id"=>"default"}],
 [{"type"=>"user_posted",
   ...
   "current_site_id"=>"default"}],
 [{"type"=>"user_replied",
   ...
   "current_site_id"=>"default"}],
 [{"post_id"=>1385, "current_site_id"=>"default"}]]

but it doesn’t seem to be there. Granted, perhaps I ran that command wrong (answer 3 on SO).

Any tips? Does the badge grant job not run by default?

Appreciate your help!

visit https://yourforum.com/sidekiq

Oh thank you! Solves everything :slight_smile: