Sha256: 401520a18023dedcc6f530e72495e1b048f5dffb34b4768afd4b17eda8576455
Contents?: true
Size: 466 Bytes
Versions: 2
Compression:
Stored size: 466 Bytes
Contents
require 'multi_json' require 'digest' module Sidekiq module Middleware module Client class UniqueJobs HASH_KEY_EXPIRATION = 30 * 60 def call(item, queue) payload_hash = Digest::MD5.hexdigest(MultiJson.encode(item)) Sidekiq.redis do |conn| return if conn.get(payload_hash) conn.setex(payload_hash, HASH_KEY_EXPIRATION, 1) end yield end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-0.9.1 | lib/sidekiq/middleware/client/unique_jobs.rb |
sidekiq-0.9.0 | lib/sidekiq/middleware/client/unique_jobs.rb |