Sha256: f1811cdf6efc694f78052b41fe3327ce1849d6124b1364e55960fdd4b7736ad4
Contents?: true
Size: 806 Bytes
Versions: 8
Compression:
Stored size: 806 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 # 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::TimeCalculator.new(item) item[LOCK_TIMEOUT] = calculator.lock_timeout item[LOCK_TTL] = calculator.lock_ttl end def add_unique_args_and_digest(item) SidekiqUniqueJobs::UniqueArgs.digest(item) end end end
Version data entries
8 entries across 8 versions & 1 rubygems