Replace sidetiq with sidekiq-cron

closes #6616
This commit is contained in:
cmrd Senya 2016-01-04 05:40:04 +03:00 committed by Dennis Schubert
parent 515cda7658
commit ed61ef6d6a
9 changed files with 37 additions and 29 deletions

View file

@ -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) * 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) * 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) * 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 ## Bug fixes
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)

View file

@ -32,12 +32,12 @@ gem "simple_captcha2", "0.3.4", require: "simple_captcha"
# Background processing # Background processing
gem "sidekiq", "3.4.2" gem "sidekiq", "4.0.1"
gem "sinatra", "1.4.6" gem "sinatra", "1.4.6"
# Scheduled processing # Scheduled processing
gem "sidetiq", "0.6.3" gem "sidekiq-cron", "0.4.1"
# Compression # Compression

View file

@ -118,6 +118,7 @@ GEM
compass (~> 1.0.0) compass (~> 1.0.0)
sass-rails (< 5.1) sass-rails (< 5.1)
sprockets (< 2.13) sprockets (< 2.13)
concurrent-ruby (1.0.0)
configurate (0.3.1) configurate (0.3.1)
connection_pool (2.2.0) connection_pool (2.2.0)
crack (0.4.3) crack (0.4.3)
@ -404,7 +405,6 @@ GEM
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
i18n-inflector (~> 2.6) i18n-inflector (~> 2.6)
railties (>= 3.0.0) railties (>= 3.0.0)
ice_cube (0.11.1)
inflecto (0.0.2) inflecto (0.0.2)
ipaddress (0.8.0) ipaddress (0.8.0)
jasmine (2.4.0) jasmine (2.4.0)
@ -728,6 +728,7 @@ GEM
ruby-oembed (0.9.0) ruby-oembed (0.9.0)
ruby-progressbar (1.7.5) ruby-progressbar (1.7.5)
rubyzip (1.1.7) rubyzip (1.1.7)
rufus-scheduler (3.2.0)
rugged (0.23.3) rugged (0.23.3)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sass (3.4.20) sass (3.4.20)
@ -752,16 +753,15 @@ GEM
shellany (0.0.1) shellany (0.0.1)
shoulda-matchers (3.0.1) shoulda-matchers (3.0.1)
activesupport (>= 4.0.0) activesupport (>= 4.0.0)
sidekiq (3.4.2) sidekiq (4.0.1)
celluloid (~> 0.16.0) concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0) connection_pool (~> 2.2, >= 2.2.0)
json (~> 1.0) json (~> 1.0)
redis (~> 3.2, >= 3.2.1) redis (~> 3.2, >= 3.2.1)
redis-namespace (~> 1.5, >= 1.5.2) sidekiq-cron (0.4.1)
sidetiq (0.6.3) redis-namespace (>= 1.5.2)
celluloid (>= 0.14.1) rufus-scheduler (>= 2.0.24)
ice_cube (= 0.11.1) sidekiq (>= 4.0.0)
sidekiq (>= 3.0.0)
sigar (0.7.3) sigar (0.7.3)
simple_captcha2 (0.3.4) simple_captcha2 (0.3.4)
rails (>= 4.1) rails (>= 4.1)
@ -998,8 +998,8 @@ DEPENDENCIES
sass-rails (= 5.0.4) sass-rails (= 5.0.4)
selenium-webdriver (= 2.47.1) selenium-webdriver (= 2.47.1)
shoulda-matchers (= 3.0.1) shoulda-matchers (= 3.0.1)
sidekiq (= 3.4.2) sidekiq (= 4.0.1)
sidetiq (= 0.6.3) sidekiq-cron (= 0.4.1)
simple_captcha2 (= 0.3.4) simple_captcha2 (= 0.3.4)
simplecov (= 0.11.1) simplecov (= 0.11.1)
sinatra (= 1.4.6) sinatra (= 1.4.6)

View file

@ -1,11 +1,7 @@
module Workers module Workers
class CleanCachedFiles < Base class CleanCachedFiles < Base
include Sidetiq::Schedulable
sidekiq_options queue: :maintenance sidekiq_options queue: :maintenance
recurrence { daily }
def perform def perform
CarrierWave.clean_cached_files! CarrierWave.clean_cached_files!
end end

View file

@ -4,12 +4,8 @@
module Workers module Workers
class QueueUsersForRemoval < Base class QueueUsersForRemoval < Base
include Sidetiq::Schedulable
sidekiq_options queue: :maintenance sidekiq_options queue: :maintenance
recurrence { daily }
def perform def perform
# Queue users for removal due to inactivity # Queue users for removal due to inactivity
if AppConfig.settings.maintenance.remove_old_users.enable? if AppConfig.settings.maintenance.remove_old_users.enable?

View file

@ -1,12 +1,7 @@
module Workers module Workers
class RecurringPodCheck < Base class RecurringPodCheck < Base
include Sidetiq::Schedulable
sidekiq_options queue: :maintenance sidekiq_options queue: :maintenance
recurrence { daily }
def perform def perform
Pod.check_all! Pod.check_all!
end end

View file

@ -52,3 +52,9 @@ end
Sidekiq.configure_client do |config| Sidekiq.configure_client do |config|
config.redis = AppConfig.get_redis_options config.redis = AppConfig.get_redis_options
end 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

View file

@ -3,7 +3,7 @@
# the COPYRIGHT file. # the COPYRIGHT file.
require 'sidekiq/web' require 'sidekiq/web'
require 'sidetiq/web' require "sidekiq/cron/web"
Diaspora::Application.routes.draw do Diaspora::Application.routes.draw do

14
config/schedule.yml Normal file
View file

@ -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