mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Remove optional middlewares [#302]
This commit is contained in:
parent
c042df43b0
commit
2cdb106de2
6 changed files with 7 additions and 79 deletions
|
@ -1,11 +1,13 @@
|
|||
HEAD
|
||||
2.1.0
|
||||
-----------
|
||||
|
||||
- Tune Celluloid to no longer run message processing within a Fiber.
|
||||
This gives us a full Thread stack and also lowers Sidekiq's memory
|
||||
usage.
|
||||
- Add pagination for lists within the Web UI [#253]
|
||||
- Add possibility to specify which Redis driver to use: *hiredis*, *synchrony* or *ruby* (default)
|
||||
- Add pagination within the Web UI [#253]
|
||||
- Specify which Redis driver to use: *hiredis* or *ruby* (default)
|
||||
- Remove FailureJobs and UniqueJobs, which have been optional server
|
||||
middleware. [#302]
|
||||
|
||||
2.0.3
|
||||
-----------
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
require 'digest'
|
||||
|
||||
module Sidekiq
|
||||
module Middleware
|
||||
module Client
|
||||
class UniqueJobs
|
||||
HASH_KEY_EXPIRATION = 30 * 60
|
||||
|
||||
def call(worker_class, item, queue)
|
||||
enabled = worker_class.get_sidekiq_options['unique']
|
||||
if enabled
|
||||
payload_hash = Digest::MD5.hexdigest(Sidekiq.dump_json(item))
|
||||
unique = false
|
||||
|
||||
Sidekiq.redis do |conn|
|
||||
conn.watch(payload_hash)
|
||||
|
||||
if conn.get(payload_hash)
|
||||
conn.unwatch
|
||||
else
|
||||
unique = conn.multi do
|
||||
conn.setex(payload_hash, HASH_KEY_EXPIRATION, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
yield if unique
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,23 +0,0 @@
|
|||
module Sidekiq
|
||||
module Middleware
|
||||
module Server
|
||||
class FailureJobs
|
||||
def call(*args)
|
||||
yield
|
||||
rescue => e
|
||||
data = {
|
||||
:failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S %Z"),
|
||||
:payload => args[1],
|
||||
:exception => e.class.to_s,
|
||||
:error => e.to_s,
|
||||
:backtrace => e.backtrace,
|
||||
:worker => args[1]['class'],
|
||||
:queue => args[2]
|
||||
}
|
||||
Sidekiq.redis {|conn| conn.rpush(:failed, Sidekiq.dump_json(data)) }
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
module Sidekiq
|
||||
module Middleware
|
||||
module Server
|
||||
class UniqueJobs
|
||||
def call(*args)
|
||||
yield
|
||||
ensure
|
||||
json = Sidekiq.dump_json(args[1])
|
||||
hash = Digest::MD5.hexdigest(json)
|
||||
Sidekiq.redis {|conn| conn.del(hash) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
module Sidekiq
|
||||
VERSION = "2.0.4"
|
||||
VERSION = "2.1.0"
|
||||
end
|
||||
|
|
|
@ -46,7 +46,6 @@ module Sidekiq
|
|||
# Allows customization for this type of Worker.
|
||||
# Legal options:
|
||||
#
|
||||
# :unique - enable the UniqueJobs middleware for this Worker, default *true*
|
||||
# :queue - use a named queue for this Worker, default 'default'
|
||||
# :retry - enable the RetryJobs middleware for this Worker, default *true*
|
||||
# :timeout - timeout the perform method after N seconds, default *nil*
|
||||
|
@ -56,7 +55,7 @@ module Sidekiq
|
|||
self.sidekiq_options_hash = get_sidekiq_options.merge(stringify_keys(opts || {}))
|
||||
end
|
||||
|
||||
DEFAULT_OPTIONS = { 'unique' => true, 'retry' => true, 'queue' => 'default' }
|
||||
DEFAULT_OPTIONS = { 'retry' => true, 'queue' => 'default' }
|
||||
|
||||
def get_sidekiq_options # :nodoc:
|
||||
self.sidekiq_options_hash ||= DEFAULT_OPTIONS
|
||||
|
|
Loading…
Reference in a new issue