diff --git a/Changelog.md b/Changelog.md index 1502e084b..2b4a71dfb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -69,6 +69,7 @@ Contributions are very welcome, the hard work is done! * Port flash messages to backbone [#6395](https://github.com/diaspora/diaspora/6395) * Change login/registration/forgot password button color [#6504](https://github.com/diaspora/diaspora/pull/6504) * A note regarding ignoring users was added to the failure messages on commenting/liking [#6646](https://github.com/diaspora/diaspora/pull/6646) +* Replace sidetiq with sidekiq-cron [#6616](https://github.com/diaspora/diaspora/pull/6616) ## Bug fixes * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) diff --git a/Gemfile b/Gemfile index 2e3ed7eb5..9df151713 100644 --- a/Gemfile +++ b/Gemfile @@ -32,12 +32,12 @@ gem "simple_captcha2", "0.3.4", require: "simple_captcha" # Background processing -gem "sidekiq", "3.4.2" +gem "sidekiq", "4.0.1" gem "sinatra", "1.4.6" # Scheduled processing -gem "sidetiq", "0.6.3" +gem "sidekiq-cron", "0.4.1" # Compression diff --git a/Gemfile.lock b/Gemfile.lock index 6e43db2e3..88fb0dd33 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,6 +118,7 @@ GEM compass (~> 1.0.0) sass-rails (< 5.1) sprockets (< 2.13) + concurrent-ruby (1.0.0) configurate (0.3.1) connection_pool (2.2.0) crack (0.4.3) @@ -404,7 +405,6 @@ GEM actionpack (>= 3.0.0) i18n-inflector (~> 2.6) railties (>= 3.0.0) - ice_cube (0.11.1) inflecto (0.0.2) ipaddress (0.8.0) jasmine (2.4.0) @@ -728,6 +728,7 @@ GEM ruby-oembed (0.9.0) ruby-progressbar (1.7.5) rubyzip (1.1.7) + rufus-scheduler (3.2.0) rugged (0.23.3) safe_yaml (1.0.4) sass (3.4.20) @@ -752,16 +753,15 @@ GEM shellany (0.0.1) shoulda-matchers (3.0.1) activesupport (>= 4.0.0) - sidekiq (3.4.2) - celluloid (~> 0.16.0) + sidekiq (4.0.1) + concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) json (~> 1.0) redis (~> 3.2, >= 3.2.1) - redis-namespace (~> 1.5, >= 1.5.2) - sidetiq (0.6.3) - celluloid (>= 0.14.1) - ice_cube (= 0.11.1) - sidekiq (>= 3.0.0) + sidekiq-cron (0.4.1) + redis-namespace (>= 1.5.2) + rufus-scheduler (>= 2.0.24) + sidekiq (>= 4.0.0) sigar (0.7.3) simple_captcha2 (0.3.4) rails (>= 4.1) @@ -998,8 +998,8 @@ DEPENDENCIES sass-rails (= 5.0.4) selenium-webdriver (= 2.47.1) shoulda-matchers (= 3.0.1) - sidekiq (= 3.4.2) - sidetiq (= 0.6.3) + sidekiq (= 4.0.1) + sidekiq-cron (= 0.4.1) simple_captcha2 (= 0.3.4) simplecov (= 0.11.1) sinatra (= 1.4.6) diff --git a/app/workers/clean_cached_files.rb b/app/workers/clean_cached_files.rb index 3497803d8..3e20e4a2c 100644 --- a/app/workers/clean_cached_files.rb +++ b/app/workers/clean_cached_files.rb @@ -1,13 +1,9 @@ module Workers class CleanCachedFiles < Base - include Sidetiq::Schedulable - sidekiq_options queue: :maintenance - recurrence { daily } - def perform CarrierWave.clean_cached_files! end - end + end end diff --git a/app/workers/queue_users_for_removal.rb b/app/workers/queue_users_for_removal.rb index b9565f7a8..bfe3a4e39 100644 --- a/app/workers/queue_users_for_removal.rb +++ b/app/workers/queue_users_for_removal.rb @@ -4,12 +4,8 @@ module Workers class QueueUsersForRemoval < Base - include Sidetiq::Schedulable - sidekiq_options queue: :maintenance - - recurrence { daily } - + def perform # Queue users for removal due to inactivity if AppConfig.settings.maintenance.remove_old_users.enable? @@ -37,5 +33,5 @@ module Workers end end end - end + end end diff --git a/app/workers/recurring_pod_check.rb b/app/workers/recurring_pod_check.rb index 3bf2d79e8..6a6940da4 100644 --- a/app/workers/recurring_pod_check.rb +++ b/app/workers/recurring_pod_check.rb @@ -1,12 +1,7 @@ - module Workers class RecurringPodCheck < Base - include Sidetiq::Schedulable - sidekiq_options queue: :maintenance - recurrence { daily } - def perform Pod.check_all! end diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 9709cc27a..fa5ed372d 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -52,3 +52,9 @@ end Sidekiq.configure_client do |config| config.redis = AppConfig.get_redis_options end + +schedule_file = "config/schedule.yml" + +if File.exist?(schedule_file) && Sidekiq.server? + Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) +end diff --git a/config/routes.rb b/config/routes.rb index 218c48911..e06d98c84 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ # the COPYRIGHT file. require 'sidekiq/web' -require 'sidetiq/web' +require "sidekiq/cron/web" Diaspora::Application.routes.draw do diff --git a/config/schedule.yml b/config/schedule.yml new file mode 100644 index 000000000..1407cfdbf --- /dev/null +++ b/config/schedule.yml @@ -0,0 +1,14 @@ +clean_cached_files: + cron: "0 0 * * *" + class: "Workers::CleanCachedFiles" + queue: "clean_cached_files" + +queue_users_for_removal: + cron: "0 0 * * *" + class: "Workers::QueueUsersForRemoval" + queue: queue_users_for_removal + +recurring_pod_check: + cron: "0 0 * * *" + class: "Workers::RecurringPodCheck" + queue: recurring_pod_check