Sha256: 24f2ef3f037228bdf88274bfe71f0ca8c1806eea0da5acd77b0d5d442a499260
Contents?: true
Size: 568 Bytes
Versions: 1
Compression:
Stored size: 568 Bytes
Contents
module DelayedJobPreventDuplicate class DuplicateChecker attr_reader :job def self.duplicate?(job) new(job).duplicate? end def initialize(job) @job = job end def duplicate? # Looking for jobs with the same signature. # Only jobs not started, otherwise it would never compute a real change if the job is currently running duplicates = Delayed::Job.where(locked_at: nil, signature: job.signature) duplicates = duplicates.where.not(id: job.id) if job.id.present? duplicates.exists? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
delayed_job_prevent_duplicate-0.2.0 | lib/delayed_job_prevent_duplicate/duplicate_checker.rb |