summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2017-10-13 10:17:41 +0200
committerOswaldo Ferreira <oswaldo@gitlab.com>2017-10-13 10:17:41 +0200
commitb78954c13d127d84fa1e10db83f51b23790aa526 (patch)
treeeacba23ba4cbb4f24f2daa2330f72f56343e6619 /lib
parent9ab0254085cc4eed5cda322b6d5998c320ceef2c (diff)
downloadgitlab-ce-b78954c13d127d84fa1e10db83f51b23790aa526.tar.gz
Simplify check for running job on Redis39032-improve-merge-ongoing-check-consistency
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/sidekiq_status.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab/sidekiq_status.rb b/lib/gitlab/sidekiq_status.rb
index a0a2769cf9e..a1f689d94d9 100644
--- a/lib/gitlab/sidekiq_status.rb
+++ b/lib/gitlab/sidekiq_status.rb
@@ -51,6 +51,13 @@ module Gitlab
self.num_running(job_ids).zero?
end
+ # Returns true if the given job is running
+ #
+ # job_id - The Sidekiq job ID to check.
+ def self.running?(job_id)
+ num_running([job_id]) > 0
+ end
+
# Returns the number of jobs that are running.
#
# job_ids - The Sidekiq job IDs to check.