mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Fix and verify ActiveJob sidekiq_options integration, fixes #4404
This commit is contained in:
parent
4deadba372
commit
5dd6a3a02c
6 changed files with 79 additions and 70 deletions
|
@ -2,9 +2,10 @@
|
|||
|
||||
[Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
|
||||
|
||||
HEAD
|
||||
6.0.4
|
||||
---------
|
||||
|
||||
- Fix ActiveJob's `sidekiq_options` integration [#4404]
|
||||
- Sidekiq Pro users will now see a Pause button next to each queue in
|
||||
the Web UI, allowing them to pause queues manually [#4374, shayonj]
|
||||
- Fix Sidekiq::Workers API unintentional change in 6.0.2 [#4387]
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -4,7 +4,7 @@ gemspec
|
|||
|
||||
gem "rake"
|
||||
gem "redis-namespace"
|
||||
gem "rails"
|
||||
gem "rails", ">= 6.0.2"
|
||||
gem "sqlite3", platforms: :ruby
|
||||
gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby
|
||||
|
||||
|
|
128
Gemfile.lock
128
Gemfile.lock
|
@ -10,78 +10,78 @@ PATH
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
actioncable (6.0.2)
|
||||
actionpack (= 6.0.2)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
activejob (= 6.0.0)
|
||||
activerecord (= 6.0.0)
|
||||
activestorage (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
actionmailbox (6.0.2)
|
||||
actionpack (= 6.0.2)
|
||||
activejob (= 6.0.2)
|
||||
activerecord (= 6.0.2)
|
||||
activestorage (= 6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
actionview (= 6.0.0)
|
||||
activejob (= 6.0.0)
|
||||
actionmailer (6.0.2)
|
||||
actionpack (= 6.0.2)
|
||||
actionview (= 6.0.2)
|
||||
activejob (= 6.0.2)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.0)
|
||||
actionview (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
actionpack (6.0.2)
|
||||
actionview (= 6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
activerecord (= 6.0.0)
|
||||
activestorage (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
actiontext (6.0.2)
|
||||
actionpack (= 6.0.2)
|
||||
activerecord (= 6.0.2)
|
||||
activestorage (= 6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
actionview (6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
activejob (6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
activerecord (6.0.0)
|
||||
activemodel (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
activestorage (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
activejob (= 6.0.0)
|
||||
activerecord (= 6.0.0)
|
||||
activemodel (6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
activerecord (6.0.2)
|
||||
activemodel (= 6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
activestorage (6.0.2)
|
||||
actionpack (= 6.0.2)
|
||||
activejob (= 6.0.2)
|
||||
activerecord (= 6.0.2)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (6.0.0)
|
||||
activesupport (6.0.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.1, >= 2.1.8)
|
||||
zeitwerk (~> 2.2)
|
||||
ast (2.4.0)
|
||||
builder (3.2.3)
|
||||
builder (3.2.4)
|
||||
byebug (11.0.1)
|
||||
coderay (1.1.2)
|
||||
concurrent-ruby (1.1.5)
|
||||
connection_pool (2.2.2)
|
||||
crass (1.0.4)
|
||||
crass (1.0.5)
|
||||
docile (1.3.2)
|
||||
erubi (1.8.0)
|
||||
erubi (1.9.0)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
hiredis (0.6.3)
|
||||
i18n (1.6.0)
|
||||
i18n (1.7.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
json (2.2.0)
|
||||
loofah (2.2.3)
|
||||
loofah (2.4.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
|
@ -93,8 +93,8 @@ GEM
|
|||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.11.3)
|
||||
nio4r (2.5.1)
|
||||
nokogiri (1.10.4)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.7)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
parallel (1.19.0)
|
||||
parser (2.6.5.0)
|
||||
|
@ -110,29 +110,29 @@ GEM
|
|||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (6.0.0)
|
||||
actioncable (= 6.0.0)
|
||||
actionmailbox (= 6.0.0)
|
||||
actionmailer (= 6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
actiontext (= 6.0.0)
|
||||
actionview (= 6.0.0)
|
||||
activejob (= 6.0.0)
|
||||
activemodel (= 6.0.0)
|
||||
activerecord (= 6.0.0)
|
||||
activestorage (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
rails (6.0.2)
|
||||
actioncable (= 6.0.2)
|
||||
actionmailbox (= 6.0.2)
|
||||
actionmailer (= 6.0.2)
|
||||
actionpack (= 6.0.2)
|
||||
actiontext (= 6.0.2)
|
||||
actionview (= 6.0.2)
|
||||
activejob (= 6.0.2)
|
||||
activemodel (= 6.0.2)
|
||||
activerecord (= 6.0.2)
|
||||
activestorage (= 6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.0)
|
||||
railties (= 6.0.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.2.0)
|
||||
loofah (~> 2.2, >= 2.2.2)
|
||||
railties (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
railties (6.0.2)
|
||||
actionpack (= 6.0.2)
|
||||
activesupport (= 6.0.2)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
|
@ -156,7 +156,7 @@ GEM
|
|||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
sprockets (3.7.2)
|
||||
sprockets (4.0.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
|
@ -167,7 +167,7 @@ GEM
|
|||
standard (0.1.6)
|
||||
rubocop (~> 0.75.0)
|
||||
rubocop-performance (~> 1.5.0)
|
||||
thor (0.20.3)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
toxiproxy (1.0.3)
|
||||
tzinfo (1.2.5)
|
||||
|
@ -176,7 +176,7 @@ GEM
|
|||
websocket-driver (0.7.1)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.4)
|
||||
zeitwerk (2.1.9)
|
||||
zeitwerk (2.2.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -186,7 +186,7 @@ DEPENDENCIES
|
|||
hiredis
|
||||
minitest
|
||||
pry-byebug
|
||||
rails
|
||||
rails (>= 6.0.2)
|
||||
rake
|
||||
redis-namespace
|
||||
sidekiq!
|
||||
|
|
|
@ -230,13 +230,17 @@ module Sidekiq
|
|||
raise(ArgumentError, "Job tags must be an Array") if item["tags"] && !item["tags"].is_a?(Array)
|
||||
# raise(ArgumentError, "Arguments must be native JSON types, see https://github.com/mperham/sidekiq/wiki/Best-Practices") unless JSON.load(JSON.dump(item['args'])) == item['args']
|
||||
|
||||
normalized_hash(item["class"])
|
||||
.each { |key, value| item[key] = value if item[key].nil? }
|
||||
# merge in the default sidekiq_options for the item's class and/or wrapped element
|
||||
# this allows ActiveJobs to control sidekiq_options too.
|
||||
defaults = normalized_hash(item["class"])
|
||||
defaults = defaults.merge(item["wrapped"].get_sidekiq_options) if item["wrapped"].respond_to?("get_sidekiq_options")
|
||||
item = defaults.merge(item)
|
||||
|
||||
item["class"] = item["class"].to_s
|
||||
item["queue"] = item["queue"].to_s
|
||||
item["jid"] ||= SecureRandom.hex(12)
|
||||
item["created_at"] ||= Time.now.to_f
|
||||
|
||||
item
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Sidekiq
|
||||
VERSION = "6.0.3"
|
||||
VERSION = "6.0.4"
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ describe 'ActiveJob' do
|
|||
it 'loads Sidekiq::Worker::Options in AJ::Base classes' do
|
||||
aj = Class.new(ActiveJob::Base) do
|
||||
queue_as :bar
|
||||
sidekiq_options retry: 4, queue: 'foo'
|
||||
sidekiq_options retry: 4, queue: 'foo', backtrace: 5
|
||||
sidekiq_retry_in { |count, _exception| count * 10 }
|
||||
sidekiq_retries_exhausted do |msg, _exception|
|
||||
Sidekiq.logger.warn "Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}"
|
||||
|
@ -41,5 +41,9 @@ describe 'ActiveJob' do
|
|||
q = Sidekiq::Queue.new("bar")
|
||||
assert_equal 1, q.size
|
||||
assert_equal 24, instance.provider_job_id.size
|
||||
|
||||
job = q.first
|
||||
assert_equal 4, job["retry"]
|
||||
assert_equal 5, job["backtrace"]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue