-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,8 @@ end | |
|
||
appraise "sidekiq-2.15" do | ||
gem "sidekiq", '2.15' | ||
end | ||
|
||
appraise "sidekiq-3.0" do | ||
gem "sidekiq", '3.0' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
source 'http://rubygems.org' | ||
gemspec | ||
|
||
gem 'appraisal', '~> 1.0.0.beta' | ||
gem 'appraisal', '~> 1.0.0' | ||
gem 'pry' | ||
gem 'pry-stack_explorer' | ||
gem 'pry-debugger' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "http://rubygems.org" | ||
|
||
gem "appraisal", "~> 1.0.0" | ||
gem "pry" | ||
gem "pry-stack_explorer" | ||
gem "pry-debugger" | ||
gem "sidekiq", "3.0" | ||
|
||
gemspec :path => "../" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,11 @@ module SidekiqUniqueJobs | |
module Middleware | ||
module Server | ||
class UniqueJobs | ||
attr_reader :unlock_order | ||
attr_reader :unlock_order, :redis_pool | ||
|
||
def call(worker, item, queue, redis_pool = nil) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mhenrixon
Author
Owner
|
||
@redis_pool = redis_pool | ||
|
||
def call(worker, item, queue) | ||
set_unlock_order(worker.class) | ||
lock_key = payload_hash(item) | ||
unlocked = before_yield? ? unlock(lock_key).inspect : 0 | ||
|
@@ -50,7 +52,11 @@ def payload_hash(item) | |
end | ||
|
||
def unlock(payload_hash) | ||
Sidekiq.redis {|conn| conn.del(payload_hash) } | ||
if redis_pool | ||
redis_pool.with { |conn| conn.del(payload_hash) } | ||
else | ||
Sidekiq.redis { |conn| conn.del(payload_hash) } | ||
end | ||
end | ||
|
||
def logger | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module SidekiqUniqueJobs | ||
VERSION = "2.7.1" | ||
VERSION = "3.0.0" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
rescue LoadError | ||
end | ||
|
||
require 'rspec/autorun' | ||
require 'rspec' | ||
|
||
require 'celluloid/test' | ||
|
3 comments
on commit f992ba4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any plans on releasing a version with Sidekiq 3 compatibility?
Currently it prevents people who rely on sidekiq-unique-jobs to upgrade to Sidekiq 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlangenberg - http://rubygems.org/gems/sidekiq-unique-jobs says 3.0.0 is released. Isn't that working for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Mikael, I simply overlooked that. Sorry.
On GitHub I saw, latest release v2.7.0 (Nov 24, 2013): https://github.com/mhenrixon/sidekiq-unique-jobs/releases
Server-side middleware does not have the same redis_pool param. This will always be nil.