lib/sidekiq/limit_fetch/global/selector.rb in sidekiq-limit_fetch-4.3.2 vs lib/sidekiq/limit_fetch/global/selector.rb in sidekiq-limit_fetch-4.4.0
- old
+ new
@@ -23,23 +23,27 @@
private
def redis_eval(script_name, args)
Sidekiq.redis do |it|
begin
- it.evalsha send("redis_#{script_name}_sha"), argv: args
- rescue Redis::CommandError => error
+ it.evalsha send("redis_#{script_name}_sha"), [], args
+ rescue Sidekiq::LimitFetch::RedisCommandError => error
raise unless error.message.include? 'NOSCRIPT'
- it.eval send("redis_#{script_name}_script"), argv: args
+ if Sidekiq::LimitFetch.post_7?
+ it.eval send("redis_#{script_name}_script"), 0, *args
+ else
+ it.eval send("redis_#{script_name}_script"), argv: args
+ end
end
end
end
def redis_acquire_sha
- @acquire_sha ||= Digest::SHA1.hexdigest redis_acquire_script
+ @acquire_sha ||= OpenSSL::Digest::SHA1.hexdigest redis_acquire_script
end
def redis_release_sha
- @release_sha ||= Digest::SHA1.hexdigest redis_release_script
+ @release_sha ||= OpenSSL::Digest::SHA1.hexdigest redis_release_script
end
def redis_acquire_script
<<-LUA
local namespace = table.remove(ARGV, 1)..'limit_fetch:'