mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Remove UniqueJobs middleware from default chain, #119
This commit is contained in:
parent
2e736be796
commit
56bda6248d
6 changed files with 30 additions and 5 deletions
22
Changes.md
22
Changes.md
|
@ -1,3 +1,25 @@
|
|||
HEAD
|
||||
-----------
|
||||
|
||||
- Sidekiq::Client.push now returns whether the actual Redis
|
||||
operation succeeded or not. [#123]
|
||||
- Remove UniqueJobs from the default middleware chain. Its
|
||||
functionality, while useful, is unexpected for new Sidekiq
|
||||
users. You can re-enable it with the following config.
|
||||
Read #119 for more discussion.
|
||||
|
||||
```ruby
|
||||
Sidekiq.client_middleware do |chain|
|
||||
require 'sidekiq/middleware/client/unique_jobs'
|
||||
chain.add Sidekiq::Middleware::Client::UniqueJobs
|
||||
end
|
||||
Sidekiq.server_middleware do |chain|
|
||||
require 'sidekiq/middleware/server/unique_jobs'
|
||||
chain.add Sidekiq::Middleware::Server::UniqueJobs
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
1.0.0
|
||||
-----------
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ module Sidekiq
|
|||
|
||||
def self.default_middleware
|
||||
Middleware::Chain.new do |m|
|
||||
m.add Middleware::Client::UniqueJobs
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ require 'sidekiq/util'
|
|||
|
||||
require 'sidekiq/middleware/server/active_record'
|
||||
require 'sidekiq/middleware/server/exception_handler'
|
||||
require 'sidekiq/middleware/server/unique_jobs'
|
||||
require 'sidekiq/middleware/server/retry_jobs'
|
||||
require 'sidekiq/middleware/server/logging'
|
||||
|
||||
|
@ -16,7 +15,6 @@ module Sidekiq
|
|||
Middleware::Chain.new do |m|
|
||||
m.add Middleware::Server::ExceptionHandler
|
||||
m.add Middleware::Server::Logging
|
||||
m.add Middleware::Server::UniqueJobs
|
||||
m.add Middleware::Server::RetryJobs
|
||||
m.add Middleware::Server::ActiveRecord
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module Sidekiq
|
||||
VERSION = "1.0.0"
|
||||
VERSION = "1.1.0"
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
sidekiq (0.11.2)
|
||||
sidekiq (1.1.0)
|
||||
celluloid (~> 0.10.0)
|
||||
connection_pool (~> 0.9.0)
|
||||
multi_json
|
||||
|
|
|
@ -15,12 +15,18 @@ class TestClient < MiniTest::Unit::TestCase
|
|||
end
|
||||
|
||||
it 'does not push duplicate messages when configured for unique only' do
|
||||
Sidekiq.client_middleware do |chain|
|
||||
chain.add Sidekiq::Middleware::Client::UniqueJobs
|
||||
end
|
||||
QueueWorker.sidekiq_options :unique => true
|
||||
10.times { Sidekiq::Client.push('class' => QueueWorker, 'args' => [1, 2]) }
|
||||
assert_equal 1, Sidekiq.redis {|c| c.llen("queue:customqueue") }
|
||||
end
|
||||
|
||||
it 'does push duplicate messages when not configured for unique only' do
|
||||
Sidekiq.client_middleware do |chain|
|
||||
chain.add Sidekiq::Middleware::Client::UniqueJobs
|
||||
end
|
||||
QueueWorker.sidekiq_options :unique => false
|
||||
10.times { Sidekiq::Client.push('class' => QueueWorker, 'args' => [1, 2]) }
|
||||
assert_equal 10, Sidekiq.redis {|c| c.llen("queue:customqueue") }
|
||||
|
|
Loading…
Reference in a new issue