Merge branch 'feature/sidekiq-cron' into 'master'
Migrate from Sidetiq to Sidekiq-cron Migrate from Sidetiq to Sidekiq-cron Updated Sidekiq to 3.5.x This will solve #2355 See merge request !1982
This commit is contained in:
commit
1da71fa9ed
6 changed files with 49 additions and 21 deletions
4
Gemfile
4
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'
|
||||
|
|
46
Gemfile.lock
46
Gemfile.lock
|
@ -117,8 +117,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)
|
||||
|
@ -370,7 +385,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)
|
||||
|
@ -641,6 +655,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)
|
||||
|
@ -668,16 +683,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)
|
||||
|
@ -743,7 +757,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)
|
||||
|
@ -938,8 +952,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)
|
||||
|
|
|
@ -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'
|
||||
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'sidekiq/web'
|
||||
require 'sidekiq/cron/web'
|
||||
require 'api/api'
|
||||
|
||||
Rails.application.routes.draw do
|
||||
|
|
10
config/schedule.yml
Normal file
10
config/schedule.yml
Normal file
|
@ -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"
|
Loading…
Reference in a new issue