I used sidekiq-cron gem below for the first time. It was so handy I thought I would use it many times in the future. I’ll summarize how to use it in order not to forget it.

Set up

# sidekiq.rbSidekiq.configure_server do |config|
config.redis = redis_config
unless Rails.env.test?
schedule_file = 'config/schedule.yml'
if File.exist?(schedule_file) && Sidekiq.server?
Sidekiq::Cron::Job.load_from_hash(YAML.load_file(schedule_file))
end
end
end
# schedule.ymlfunction_name:
cron: "*/10 * * * *" # => executed every 10 minutes
class: "SomeFunctionJob"
queue: default
second_function_name:
cron: "0 9 * * *"
class: "SecondFunctionJob"
queue: default

My LinkedIn account is below! Please contact me!

https://www.linkedin.com/in/tomoharu-tsutsumi-56051a126/