lib/sidekiq_unique_jobs/scripts.rb in sidekiq-unique-jobs-4.0.8 vs lib/sidekiq_unique_jobs/scripts.rb in sidekiq-unique-jobs-4.0.9
- old
+ new
@@ -3,17 +3,19 @@
module SidekiqUniqueJobs
ScriptError = Class.new(StandardError)
module Scripts
- extend Forwardable
LUA_PATHNAME ||= Pathname.new(__FILE__).dirname.join('../../redis').freeze
SOURCE_FILES ||= Dir[LUA_PATHNAME.join('**/*.lua')].compact.freeze
DEFINED_METHODS ||= []
module_function
+ extend SingleForwardable
+ def_delegator :SidekiqUniqueJobs, :connection
+
def script_shas
@script_shas ||= {}
end
def logger
@@ -29,15 +31,9 @@
raise ScriptError,
"#{file_name}.lua\n\n" +
ex.message + "\n\n" +
script_source(file_name) +
ex.backtrace.join("\n")
- end
-
- def connection(redis_pool, &_block)
- SidekiqUniqueJobs.connection(redis_pool) do |conn|
- yield conn
- end
end
def script_source(file_name)
script_path(file_name).read
end