lib/sidekiq/throttled/strategy/concurrency.rb in sidekiq-throttled-0.17.0 vs lib/sidekiq/throttled/strategy/concurrency.rb in sidekiq-throttled-0.18.0
- old
+ new
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require "redis/prescription"
+require "redis_prescription"
require "sidekiq/throttled/strategy/base"
module Sidekiq
module Throttled
@@ -18,11 +18,11 @@
# return 1
# else
# PUSH(@key, @jid)
# return 0
# end
- SCRIPT = Redis::Prescription.read "#{__dir__}/concurrency.lua"
+ SCRIPT = RedisPrescription.new(File.read("#{__dir__}/concurrency.lua"))
private_constant :SCRIPT
# @param [#to_s] strategy_key
# @param [#to_i, #call] limit Amount of allowed concurrent jobs
# per processors running for given key.
@@ -48,10 +48,10 @@
keys = [key(job_args)]
argv = [jid.to_s, job_limit, @ttl, Time.now.to_f]
Sidekiq.redis do |redis|
- 1 == SCRIPT.eval(redis, :keys => keys, :argv => argv)
+ 1 == SCRIPT.call(redis, :keys => keys, :argv => argv)
end
end
# @return [Integer] Current count of jobs
def count(*job_args)