Skip to content

Commit 2c82baf

Browse files
author
Simon Peeters
committed
don't add duplicate jobs
1 parent 7350b47 commit 2c82baf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: app/workers/githosting_shell_worker.rb

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ class GithostingShellWorker
33

44
sidekiq_options queue: :redmine_git_hosting, retry: false
55

6+
def self.maybe_do(command, object, options = {})
7+
args = [command.to_s, object, options]
8+
Sidekiq::Queue.new(:redmine_git_hosting).each do |job|
9+
return if job.args == args
10+
end
11+
12+
perform_async(command, object, options)
13+
end
14+
615
def perform(command, object, options = {})
716
logger.info("#{command} | #{object} | #{options}")
817
RedmineGitHosting::GitoliteWrapper.resync_gitolite(command, object, options)

Diff for: lib/redmine_git_hosting/gitolite_accessor.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def resync_gitolite(command, object, options = {})
140140
end
141141

142142
if RedmineGitHosting::Config.gitolite_use_sidekiq? && !bypass
143-
GithostingShellWorker.perform_async(command, object, options)
143+
GithostingShellWorker.maybe_do(command, object, options)
144144
else
145145
GitoliteWrapper.resync_gitolite(command, object, options)
146146
end

0 commit comments

Comments
 (0)