Skip to content

Commit

Permalink
Update sidekiq version (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Timur committed May 11, 2022
1 parent 2ab65ba commit 009a33b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 24 deletions.
13 changes: 5 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PATH
specs:
sidekiq-group (0.1.6)
activesupport (>= 5.0)
sidekiq (>= 5.1, < 6)
sidekiq (>= 5.1, < 6.5)

GEM
remote: http://rubygems.org/
Expand All @@ -26,8 +26,6 @@ GEM
parser (3.0.0.0)
ast (~> 2.4.1)
rack (2.0.9)
rack-protection (2.1.0)
rack
rainbow (3.0.0)
rake (13.0.3)
redis (4.2.5)
Expand Down Expand Up @@ -66,11 +64,10 @@ GEM
rubocop (~> 1.0)
rubocop-ast (>= 1.1.0)
ruby-progressbar (1.11.0)
sidekiq (5.2.8)
connection_pool (~> 2.2, >= 2.2.2)
rack (< 2.1.0)
rack-protection (>= 1.5.0)
redis (>= 3.3.5, < 5)
sidekiq (6.4.2)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
thread_safe (0.3.6)
tzinfo (1.2.7)
thread_safe (~> 0.1)
Expand Down
3 changes: 1 addition & 2 deletions lib/sidekiq/group.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'sidekiq/logging'
require 'sidekiq/group/version'
require 'sidekiq/group/collection'
require 'sidekiq/group/middleware'
Expand Down Expand Up @@ -32,7 +31,7 @@ def on_complete(_options = {})
end

def sidekiq_logger
Sidekiq::Logging.logger
Sidekiq.logger
end
end
end
24 changes: 12 additions & 12 deletions lib/sidekiq/group/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def add(jid)
Sidekiq::Logging.logger.info "Scheduling child job #{jid} for parent #{@cid}" if Sidekiq::Group.debug

Sidekiq.redis do |r|
r.multi do
r.sadd("#{@cid}-jids", jid)
r.expire("#{@cid}-jids", CID_EXPIRE_TTL)
r.multi do |pipeline|
pipeline.sadd("#{@cid}-jids", jid)
pipeline.expire("#{@cid}-jids", CID_EXPIRE_TTL)
end
end
end
Expand Down Expand Up @@ -81,18 +81,18 @@ def spawned_all_jobs?

def callback_data
Sidekiq.redis do |r|
r.multi do
r.hget(@cid, 'callback_class')
r.hget(@cid, 'callback_options')
r.multi do |pipeline|
pipeline.hget(@cid, 'callback_class')
pipeline.hget(@cid, 'callback_options')
end
end
end

def persist(attribute, value)
Sidekiq.redis do |r|
r.multi do
r.hset(@cid, attribute, value)
r.expire(@cid, CID_EXPIRE_TTL)
r.multi do |pipeline|
pipeline.hset(@cid, attribute, value)
pipeline.expire(@cid, CID_EXPIRE_TTL)
end
end
end
Expand All @@ -103,9 +103,9 @@ def cleanup_redis

def locked?
Sidekiq.redis do |r|
r.multi do
r.getset("#{@cid}-finished", 1)
r.expire("#{@cid}-finished", LOCK_TTL)
r.multi do |pipeline|
pipeline.getset("#{@cid}-finished", 1)
pipeline.expire("#{@cid}-finished", LOCK_TTL)
end.first
end
end
Expand Down
2 changes: 1 addition & 1 deletion sidekiq-group.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.4.0'
spec.add_dependency 'activesupport', '>= 5.0'
spec.add_dependency 'sidekiq', '>= 5.1', '< 6'
spec.add_dependency 'sidekiq', '>= 5.1', '< 6.5'

spec.add_development_dependency 'bundler', '~> 1.17'
spec.add_development_dependency 'rake', '~> 13.0'
Expand Down
2 changes: 1 addition & 1 deletion spec/sidekiq/group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def invalid_perform
it { expect(collection).to have_received(:spawned_jobs!) }

context 'when on_complete is not defined' do
let(:logger) { Sidekiq::Logging.logger }
let(:logger) { Sidekiq.logger }

before do
allow(logger).to receive(:warn)
Expand Down

0 comments on commit 009a33b

Please sign in to comment.