lib/sidekiq_unique_jobs/scripts.rb in sidekiq-unique-jobs-4.0.17 vs lib/sidekiq_unique_jobs/scripts.rb in sidekiq-unique-jobs-4.0.18
- old
+ new
@@ -26,14 +26,17 @@
connection(redis_pool) do |redis|
script_shas[file_name] ||= redis.script(:load, script_source(file_name))
redis.evalsha(script_shas[file_name], options)
end
rescue Redis::CommandError => ex
- raise ScriptError,
- "#{file_name}.lua\n\n" +
- ex.message + "\n\n" +
- script_source(file_name) +
- ex.backtrace.join("\n")
+ if ex.message == 'NOSCRIPT No matching script. Please use EVAL.'
+ script_shas[file_name] = nil
+ call(file_name, redis_pool, options)
+ else
+ raise ScriptError,
+ "#{file_name}.lua\n\n#{ex.message}\n\n#{script_source(file_name)}" \
+ "#{ex.backtrace.join("\n")}"
+ end
end
def script_source(file_name)
script_path(file_name).read
end