Sha256: b8e621fa4f0eb4c31ae2d62617ee86a98f1daee9d6b118344ebacd7248a0d778
Contents?: true
Size: 886 Bytes
Versions: 1
Compression:
Stored size: 886 Bytes
Contents
# frozen_string_literal: true module SidekiqUniqueJobs # Utility class to append uniqueness to the sidekiq job hash # # @author Mikael Henriksson <mikael@zoolutions.se> module Job extend self # rubocop:disable Style/ModuleFunction # Adds timeout, expiration, unique_args, unique_prefix and unique_digest to the sidekiq job hash # @return [void] nothing returned here matters def add_uniqueness(item) add_timeout_and_expiration(item) add_unique_args_and_digest(item) end private def add_timeout_and_expiration(item) calculator = SidekiqUniqueJobs::Timeout::Calculator.new(item) item[LOCK_TIMEOUT_KEY] = calculator.lock_timeout item[LOCK_EXPIRATION_KEY] = calculator.lock_expiration end def add_unique_args_and_digest(item) SidekiqUniqueJobs::UniqueArgs.digest(item) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-unique-jobs-6.0.7 | lib/sidekiq_unique_jobs/job.rb |