Skip to content

Commit

Permalink
Fix active worker detection by using correct keys (#756)
Browse files Browse the repository at this point in the history
Rename keys from :workers to :work since that's correct name set in Redis
  • Loading branch information
dodo121 authored and mhenrixon committed Jul 14, 2023
1 parent 0253377 commit 9b13b83
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ local function find_digest_in_process_set(digest, threshold)
log_debug("Found number of processes:", #processes, "next cursor:", next_process_cursor)

for _, process in ipairs(processes) do
local workers_key = process .. ":workers"
local workers_key = process .. ":work"
log_debug("searching in process set:", process,
"for digest:", digest,
"cursor:", process_cursor)
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def active?(digest) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticCo
else
pipeline.exists(key)
end
pipeline.hgetall("#{key}:workers")
pipeline.hgetall("#{key}:work")
end

next unless valid
Expand Down
2 changes: 1 addition & 1 deletion spec/sidekiq_unique_jobs/lua/reap_orphans_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
context "with job" do
let(:process_key) { "process-id" }
let(:thread_id) { "thread-id" }
let(:worker_key) { "#{process_key}:workers" }
let(:worker_key) { "#{process_key}:work" }

before do
SidekiqUniqueJobs.redis do |conn|
Expand Down
2 changes: 1 addition & 1 deletion spec/sidekiq_unique_jobs/orphans/reaper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
context "with job in process" do
let(:process_key) { "process-id" }
let(:thread_id) { "thread-id" }
let(:worker_key) { "#{process_key}:workers" }
let(:worker_key) { "#{process_key}:work" }
let(:created_at) { (Time.now - reaper_timeout).to_f }
let(:reaper_timeout) { SidekiqUniqueJobs.config.reaper_timeout }

Expand Down

0 comments on commit 9b13b83

Please sign in to comment.