diff options
author | Gabriel Mazetto <gabriel@gitlab.com> | 2016-07-18 12:57:57 +0200 |
---|---|---|
committer | Gabriel Mazetto <gabriel@gitlab.com> | 2016-07-18 23:52:58 +0200 |
commit | aaba9ebbb196ae421178e962ccc1078fdcb98843 (patch) | |
tree | f001fe2a066c95f67235b4d3a2cdb2e0f4692d9a /config/initializers/sidekiq.rb | |
parent | aba558a4a8c7e9e3c691c0e689a0926d4604a26a (diff) | |
download | gitlab-ce-aaba9ebbb196ae421178e962ccc1078fdcb98843.tar.gz |
Improve cron_jobs loading error messages
Diffstat (limited to 'config/initializers/sidekiq.rb')
-rw-r--r-- | config/initializers/sidekiq.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 593c14a289f..b40fd81ff96 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -13,7 +13,14 @@ Sidekiq.configure_server do |config| # UGLY Hack to get nested hash from settingslogic cron_jobs = JSON.parse(Gitlab.config.cron_jobs.to_json) # UGLY hack: Settingslogic doesn't allow 'class' key - cron_jobs.each { |k, v| cron_jobs[k]['class'] = cron_jobs[k].delete('job_class') } + cron_jobs_required_keys = %w(job_class cron) + cron_jobs.each do |k, v| + if cron_jobs[k] && cron_jobs_required_keys.all? { |s| cron_jobs[k].key?(s) } + cron_jobs[k]['class'] = cron_jobs[k].delete('job_class') + else + raise("Invalid cron_jobs config key: '#{k}'. Check your gitlab config file.") + end + end Sidekiq::Cron::Job.load_from_hash! cron_jobs # Database pool should be at least `sidekiq_concurrency` + 2 |