Created
October 12, 2022 14:16
-
-
Save jcreed/24000f36a21e8207f29fbd6e97749094 to your computer and use it in GitHub Desktop.
change over to sidekiq scheduler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** - branch https://github.com/Liaison-Intl/WebAdMIT/compare/feature/NF-53110...run-ci/feature/testing-sftp-swap | |
Gemfile | |
gem 'sidekiq-scheduler' | |
**** | |
Initializer Sidekiq | |
unless ENV['RUNNING_ASSETS_PRECOMPILE'] | |
require 'sidekiq-scheduler' | |
Sidekiq.configure_server do |config| | |
config.redis = RedisConnection.configuration.dup | |
config.death_handlers << ->(job, ex) do | |
Airbrake.notify( | |
ex, | |
error_message: "#{job['class']} #{job["jid"]} just died with error #{ex.message}." | |
) | |
end | |
config.client_middleware do |chain| | |
chain.add SidekiqUniqueJobs::Middleware::Client | |
end | |
config.server_middleware do |chain| | |
chain.add SidekiqUniqueJobs::Middleware::Server | |
end | |
SidekiqUniqueJobs::Server.configure(config) | |
config.on(:startup) do | |
Sidekiq.schedule = YAML.load_file(File.join(Rails.root, 'config/sidekiq_schedule.yml')) | |
SidekiqScheduler::Scheduler.instance.reload_schedule! | |
end | |
end | |
***** | |
Routes.rb | |
require 'sidekiq/web' | |
require 'sidekiq-scheduler/web'. #new | |
require 'resque-job-stats/server' | |
**** | |
Sidekiq.tyml | |
- ["scheduler", 3] | |
**** | |
config/sidekiq_schedule.yml #new | |
schedule_search_job: | |
cron: "*/15 * * * *" | |
class: "ScheduleSearchJob" | |
queue: scheduler | |
description: "This job search for schedules that should be performed" | |
**** | |
Drop resque.rake changes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment