lib/sidekiq/throttled/strategy/concurrency.rb in sidekiq-throttled-0.5.0 vs lib/sidekiq/throttled/strategy/concurrency.rb in sidekiq-throttled-0.6.0

- old
+ new

@@ -12,11 +12,11 @@ # # return 1 if @limit <= LLEN(@key) # # PUSH(@key, @jid) # return 0 - SCRIPT = Script.new File.read "#{__dir__}/concurrency.lua" + SCRIPT = Script.read "#{__dir__}/concurrency.lua" private_constant :SCRIPT # @param [#to_s] strategy_key # @param [Hash] opts # @option opts [#to_i] :limit Amount of allowed concurrent jobs @@ -42,10 +42,10 @@ @key_suffix || @limit.respond_to?(:call) end # @return [Boolean] whenever job is throttled or not def throttled?(jid, *job_args) - 1 == SCRIPT.eval([key(job_args)], [limit(job_args), @ttl, jid.to_s]) + 1 == SCRIPT.eval([key(job_args), jid.to_s], [limit(job_args), @ttl]) end # @return [Integer] Current count of jobs def count(*job_args) Sidekiq.redis { |conn| conn.scard(key(job_args)) }.to_i