mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Move payload json verification after middleware, fixes #5246
This commit is contained in:
parent
e2c3e2c704
commit
a8c4966cdc
3 changed files with 5 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
HEAD
|
||||
---------
|
||||
|
||||
- Strict argument checking now runs after client-side middleware [#5246]
|
||||
- Fix page events with live polling [#5184]
|
||||
- Many under-the-hood changes to remove all usage of the term "worker"
|
||||
from the Sidekiq codebase and APIs. This mostly involved RDoc and local
|
||||
|
|
|
@ -75,6 +75,7 @@ module Sidekiq
|
|||
normed
|
||||
end
|
||||
if payload
|
||||
verify_json(payload)
|
||||
raw_push([payload])
|
||||
payload["jid"]
|
||||
end
|
||||
|
@ -110,6 +111,7 @@ module Sidekiq
|
|||
copy = normed.merge("args" => job_args, "jid" => SecureRandom.hex(12))
|
||||
copy["at"] = (at.is_a?(Array) ? at[index] : at) if at
|
||||
result = middleware.invoke(copy["class"], copy, copy["queue"], @redis_pool) do
|
||||
verify_json(copy)
|
||||
copy
|
||||
end
|
||||
result || nil
|
||||
|
|
|
@ -12,7 +12,9 @@ module Sidekiq
|
|||
raise(ArgumentError, "Job class must be either a Class or String representation of the class name: `#{item}`") unless item["class"].is_a?(Class) || item["class"].is_a?(String)
|
||||
raise(ArgumentError, "Job 'at' must be a Numeric timestamp: `#{item}`") if item.key?("at") && !item["at"].is_a?(Numeric)
|
||||
raise(ArgumentError, "Job tags must be an Array: `#{item}`") if item["tags"] && !item["tags"].is_a?(Array)
|
||||
end
|
||||
|
||||
def verify_json(item)
|
||||
job_class = item["wrapped"] || item["class"]
|
||||
if Sidekiq.options[:on_complex_arguments] == :raise
|
||||
msg = <<~EOM
|
||||
|
|
Loading…
Reference in a new issue