summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-19 22:26:54 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-19 22:26:54 +0200
commit825e617fe99099273898c7bccd53b72e62ddb0e3 (patch)
treef7ee7cdca7fd5342c0a25d657fadee32abaaa27a
parenta96756008a634961171e968d76faea68ab2bcb95 (diff)
downloadgitlab-ce-unique-sidekiq-jobs.tar.gz
Run only one pipeline and project processing when scheduled multiple timesunique-sidekiq-jobs
-rw-r--r--CHANGELOG.md1
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock4
-rw-r--r--app/workers/pipeline_process_worker.rb2
-rw-r--r--app/workers/pipeline_update_worker.rb2
-rw-r--r--app/workers/project_cache_worker.rb3
6 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f4d317fd1db..dffc9dc79ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Change user & group landing page routing from /u/:username to /:username
- Added documentation for .gitattributes files
- Move Pipeline Metrics to separate worker
+ - Run only one pipeline and project processing when scheduled multiple times
- AbstractReferenceFilter caches project_refs on RequestStore when active
- Replaced the check sign to arrow in the show build view. !6501
- Add a /wip slash command to toggle the Work In Progress status of a merge request. !6259 (tbalthazar)
diff --git a/Gemfile b/Gemfile
index 05166b6a828..ee83e50317e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -136,6 +136,7 @@ gem 'acts-as-taggable-on', '~> 4.0'
# Background jobs
gem 'sidekiq', '~> 4.2'
gem 'sidekiq-cron', '~> 0.4.0'
+gem 'sidekiq-unique-jobs'
gem 'redis-namespace', '~> 1.5.2'
# HTTP requests
diff --git a/Gemfile.lock b/Gemfile.lock
index a9892d1c130..63c32155f8a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -685,6 +685,9 @@ GEM
redis-namespace (>= 1.5.2)
rufus-scheduler (>= 2.0.24)
sidekiq (>= 4.0.0)
+ sidekiq-unique-jobs (4.0.18)
+ sidekiq (>= 2.6)
+ thor
simplecov (0.12.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
@@ -961,6 +964,7 @@ DEPENDENCIES
shoulda-matchers (~> 2.8.0)
sidekiq (~> 4.2)
sidekiq-cron (~> 0.4.0)
+ sidekiq-unique-jobs
simplecov (= 0.12.0)
slack-notifier (~> 1.2.0)
spinach-rails (~> 0.2.1)
diff --git a/app/workers/pipeline_process_worker.rb b/app/workers/pipeline_process_worker.rb
index f44227d7086..f659979e5a6 100644
--- a/app/workers/pipeline_process_worker.rb
+++ b/app/workers/pipeline_process_worker.rb
@@ -1,7 +1,7 @@
class PipelineProcessWorker
include Sidekiq::Worker
- sidekiq_options queue: :default
+ sidekiq_options queue: :default, unique: :until_executed
def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id)
diff --git a/app/workers/pipeline_update_worker.rb b/app/workers/pipeline_update_worker.rb
index 44a7f24e401..d61dd96958f 100644
--- a/app/workers/pipeline_update_worker.rb
+++ b/app/workers/pipeline_update_worker.rb
@@ -1,7 +1,7 @@
class PipelineUpdateWorker
include Sidekiq::Worker
- sidekiq_options queue: :default
+ sidekiq_options queue: :default, unique: :until_executed
def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id)
diff --git a/app/workers/project_cache_worker.rb b/app/workers/project_cache_worker.rb
index ccefd0f71a0..7396a18d66a 100644
--- a/app/workers/project_cache_worker.rb
+++ b/app/workers/project_cache_worker.rb
@@ -1,7 +1,8 @@
class ProjectCacheWorker
include Sidekiq::Worker
- sidekiq_options queue: :default
+ sidekiq_options queue: :default, unique: :until_executed
+
def perform(project_id)
project = Project.find(project_id)