summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2015-12-03 21:24:39 -0200
committerGabriel Mazetto <brodock@gmail.com>2015-12-04 11:29:45 -0200
commit496870ddec632ae13cff8b5e8f6ca0bff0fa3ec7 (patch)
tree5d6cfe38c84dd1693ba7441c26f62dbff5a24e39
parent95fd79834acd41cc8bc5013bf94fd6770eb13271 (diff)
downloadgitlab-ce-496870ddec632ae13cff8b5e8f6ca0bff0fa3ec7.tar.gz
Migrate from Sidetiq to Sidekiq-cronfeature/sidekiq-cron
Updated Sidekiq to 3.5.x
-rw-r--r--Gemfile4
-rw-r--r--Gemfile.lock46
-rw-r--r--app/workers/stuck_ci_builds_worker.rb3
-rw-r--r--config/initializers/sidekiq.rb6
-rw-r--r--config/routes.rb1
-rw-r--r--config/schedule.yml10
6 files changed, 49 insertions, 21 deletions
diff --git a/Gemfile b/Gemfile
index 67640bb9ae0..954c5e13503 100644
--- a/Gemfile
+++ b/Gemfile
@@ -120,8 +120,8 @@ gem 'acts-as-taggable-on', '~> 3.4'
# Background jobs
gem 'sinatra', '~> 1.4.4', require: nil
-gem 'sidekiq', '3.3.0'
-gem 'sidetiq', '~> 0.6.3'
+gem 'sidekiq', '~> 3.5.0'
+gem 'sidekiq-cron', '~> 0.3.0'
# HTTP requests
gem "httparty", '~> 0.13.3'
diff --git a/Gemfile.lock b/Gemfile.lock
index cd1855758b2..67807bed4c4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -116,8 +116,23 @@ GEM
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
- celluloid (0.16.0)
- timers (~> 4.0.0)
+ celluloid (0.17.2)
+ celluloid-essentials
+ celluloid-extras
+ celluloid-fsm
+ celluloid-pool
+ celluloid-supervision
+ timers (>= 4.1.1)
+ celluloid-essentials (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-extras (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-fsm (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-pool (0.20.5)
+ timers (>= 4.1.1)
+ celluloid-supervision (0.20.5)
+ timers (>= 4.1.1)
charlock_holmes (0.7.3)
chunky_png (1.3.5)
cliver (0.3.2)
@@ -369,7 +384,6 @@ GEM
multi_xml (>= 0.5.2)
httpclient (2.7.0.1)
i18n (0.7.0)
- ice_cube (0.11.1)
ice_nine (0.11.1)
inflecto (0.0.2)
ipaddress (0.8.0)
@@ -640,6 +654,7 @@ GEM
sexp_processor (~> 4.1)
rubyntlm (0.5.2)
rubypants (0.2.0)
+ rufus-scheduler (3.1.10)
rugged (0.23.3)
safe_yaml (1.0.4)
sanitize (2.1.0)
@@ -667,16 +682,15 @@ GEM
rack
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
- sidekiq (3.3.0)
- celluloid (>= 0.16.0)
- connection_pool (>= 2.0.0)
- json
- redis (>= 3.0.6)
- redis-namespace (>= 1.3.1)
- sidetiq (0.6.3)
- celluloid (>= 0.14.1)
- ice_cube (= 0.11.1)
- sidekiq (>= 3.0.0)
+ sidekiq (3.5.3)
+ celluloid (~> 0.17.2)
+ connection_pool (~> 2.2, >= 2.2.0)
+ json (~> 1.0)
+ redis (~> 3.2, >= 3.2.1)
+ redis-namespace (~> 1.5, >= 1.5.2)
+ sidekiq-cron (0.3.1)
+ rufus-scheduler (>= 2.0.24)
+ sidekiq (>= 2.17.3)
simple_oauth (0.1.9)
simplecov (0.10.0)
docile (~> 1.1.0)
@@ -742,7 +756,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
- timers (4.0.4)
+ timers (4.1.1)
hitimes
timfel-krb5-auth (0.8.3)
tinder (1.10.1)
@@ -936,8 +950,8 @@ DEPENDENCIES
settingslogic (~> 2.0.9)
sham_rack
shoulda-matchers (~> 2.8.0)
- sidekiq (= 3.3.0)
- sidetiq (~> 0.6.3)
+ sidekiq (~> 3.5.0)
+ sidekiq-cron (~> 0.3.0)
simplecov (~> 0.10.0)
sinatra (~> 1.4.4)
six (~> 0.2.0)
diff --git a/app/workers/stuck_ci_builds_worker.rb b/app/workers/stuck_ci_builds_worker.rb
index 4e5eddbaba1..ca594e77e7c 100644
--- a/app/workers/stuck_ci_builds_worker.rb
+++ b/app/workers/stuck_ci_builds_worker.rb
@@ -1,11 +1,8 @@
class StuckCiBuildsWorker
include Sidekiq::Worker
- include Sidetiq::Schedulable
BUILD_STUCK_TIMEOUT = 1.day
- recurrence { daily }
-
def perform
Rails.logger.info 'Cleaning stuck builds'
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index e856499732e..6e5701e33da 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -17,6 +17,12 @@ Sidekiq.configure_server do |config|
chain.add Gitlab::SidekiqMiddleware::ArgumentsLogger if ENV['SIDEKIQ_LOG_ARGUMENTS']
chain.add Gitlab::SidekiqMiddleware::MemoryKiller if ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS']
end
+
+ # Sidekiq-cron: load recurring jobs from schedule.yml
+ schedule_file = 'config/schedule.yml'
+ if File.exists?(schedule_file)
+ Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file)
+ end
end
Sidekiq.configure_client do |config|
diff --git a/config/routes.rb b/config/routes.rb
index 5c114452a3f..6aa822bf859 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,5 @@
require 'sidekiq/web'
+require 'sidekiq/cron/web'
require 'api/api'
Rails.application.routes.draw do
diff --git a/config/schedule.yml b/config/schedule.yml
new file mode 100644
index 00000000000..993a95fef56
--- /dev/null
+++ b/config/schedule.yml
@@ -0,0 +1,10 @@
+# Here is a list of jobs that are scheduled to run periodically.
+# We use a UNIX cron notation to specify execution schedule.
+#
+# Please read here for more information:
+# https://github.com/ondrejbartas/sidekiq-cron#adding-cron-job
+
+stuck_ci_builds_worker:
+ cron: "0 0 * * *"
+ class: "StuckCiBuildsWorker"
+ queue: "default"