Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RubyReaper treats runtime lock as orphan and delete it #580

Closed
yaoyi opened this issue Mar 18, 2021 · 2 comments · Fixed by #582
Closed

RubyReaper treats runtime lock as orphan and delete it #580

yaoyi opened this issue Mar 18, 2021 · 2 comments · Fixed by #582
Assignees

Comments

@yaoyi
Copy link

yaoyi commented Mar 18, 2021

when using until_and_while_executing, RubyReaper treats runtime lock as orphan and delete it, which causes duplicate running jobs.

in the follow codes, digest in workers is without suffix "RUN"

def active?(digest) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
        Sidekiq.redis do |conn|
          procs = conn.sscan_each("processes").to_a
          return false if procs.empty?

          procs.sort.each do |key|
            valid, workers = conn.pipelined do
              conn.exists(key)
              conn.hgetall("#{key}:workers")
            end

            next unless valid
            next unless workers.any?

            workers.each_pair do |_tid, job|
              next unless (item = safe_load_json(job))

              payload = safe_load_json(item[PAYLOAD])

              return true if payload[LOCK_DIGEST] == digest
              return true if considered_active?(payload[CREATED_AT])
            end
          end

          false
        end
      end
@mhenrixon
Copy link
Owner

Thanks for the report @yaoyi, I'll see what I can do about that!

@mhenrixon
Copy link
Owner

Released as v7.0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants