1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

payload should exposed as a Hash, fixes #4387

This commit is contained in:
Mike Perham 2019-11-22 09:53:44 -08:00
parent 2ecb6fa00b
commit 83c9524fb4
3 changed files with 8 additions and 2 deletions

View file

@ -7,6 +7,7 @@ HEAD
- 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]
6.0.3

View file

@ -926,7 +926,11 @@ module Sidekiq
}
next unless valid
workers.each_pair do |tid, json|
yield key, tid, Sidekiq.load_json(json)
hsh = Sidekiq.load_json(json)
p = hsh["payload"]
# avoid breaking API, this is a side effect of the JSON optimization in #4316
hsh["payload"] = Sidekiq.load_json(p) if p.is_a?(String)
yield key, tid, hsh
end
end
end

View file

@ -580,7 +580,7 @@ describe 'API' do
end
s = "#{key}:workers"
data = Sidekiq.dump_json({ 'payload' => {}, 'queue' => 'default', 'run_at' => Time.now.to_i })
data = Sidekiq.dump_json({ 'payload' => "{}", 'queue' => 'default', 'run_at' => Time.now.to_i })
Sidekiq.redis do |c|
c.hmset(s, '1234', data)
end
@ -589,6 +589,7 @@ describe 'API' do
assert_equal key, p
assert_equal "1234", x
assert_equal 'default', y['queue']
assert_equal({}, y['payload'])
assert_equal Time.now.year, Time.at(y['run_at']).year
end