Skip to content

Ruby Reaper active check incorrect #557

@courtneymiller2010

Description

@courtneymiller2010

Describe the bug
The ruby reaper is reaping active jobs. It appears the job json being returned from sidekiq is different than what is expected.

Expected behavior
If a job is active, it shouldn't be reaped.

Current behavior
The ruby reaper is reaping active jobs.

Worker class

module Debugging
  class ProcessWorker
    include Sidekiq::Worker
    sidekiq_options queue: "default", retry: 0, lock: :until_executed, on_conflict: :log

    def perform
      puts "Starting ProcessWorker"
      sleep(5)
      puts "Finishing ProcessWorker"
    end
  end
end

Additional context

sidekiq: v5.2.9
sidekiq-unique-jobs: v7.0.0.beta27

I believe the problem is here:
return true if load_json(job)[LOCK_DIGEST] == digest

If I log load_json(job), this is what I get:

{
 queue: "default",
 payload: {
   class: "Debugging::ProcessWorker",
   args: [],
   retry: 0,
   queue: "default",
   lock: "until_executed",
   on_conflict: "log",
   jid: "c81cb486b2d73357d97e57ba",
   created_at: 1609964935.1892679,
   lock_timeout 0,
   lock_ttl: nil,
   lock_prefix: "uniquejobs",
   lock_args: [],
   lock_digest: "uniquejobs:512613aedf8d8099a473a343e0bc352c",
   enqueued_at: 1609964935.202131
 },
 run_at: 1609964935
}

Replacing that line with the below fixes the issue for me:
return true if load_json(job)["payload"][LOCK_DIGEST] == digest

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions