lib/sidekiq/throttled.rb in sidekiq-throttled-0.15.1 vs lib/sidekiq/throttled.rb in sidekiq-throttled-0.16.0

- old
+ new

@@ -7,10 +7,11 @@ require "sidekiq/throttled/version" require "sidekiq/throttled/communicator" require "sidekiq/throttled/configuration" require "sidekiq/throttled/queues_pauser" require "sidekiq/throttled/registry" +require "sidekiq/throttled/job" require "sidekiq/throttled/worker" require "sidekiq/throttled/utils" # @see https://github.com/mperham/sidekiq/ module Sidekiq @@ -72,13 +73,14 @@ # Tells whenever job is throttled or not. # # @param [String] message Job's JSON payload # @return [Boolean] - def throttled?(message) + def throttled?(message) # rubocop:disable Metrics/MethodLength message = JSON.parse message - job = message.fetch("class") { return false } - jid = message.fetch("jid") { return false } + job = message.fetch("class") { return false } + job = message.fetch("wrapped") { return false } if job == "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper" + jid = message.fetch("jid") { return false } preload_constant! job Registry.get job do |strategy| return strategy.throttled?(jid, *message["args"])