lib/sidekiq_unique_jobs/scripts.rb in sidekiq-unique-jobs-5.0.0 vs lib/sidekiq_unique_jobs/scripts.rb in sidekiq-unique-jobs-5.0.1

- old
+ new

@@ -1,25 +1,27 @@ require 'pathname' require 'digest/sha1' require 'concurrent/map' +require 'sidekiq_unique_jobs/scripts/acquire_lock' +require 'sidekiq_unique_jobs/scripts/release_lock' module SidekiqUniqueJobs - ScriptError = Class.new(StandardError) + ScriptError = Class.new(StandardError) + UniqueKeyMissing = Class.new(ArgumentError) + JidMissing = Class.new(ArgumentError) + MaxLockTimeMissing = Class.new(ArgumentError) + UnexpectedValue = Class.new(StandardError) module Scripts LUA_PATHNAME ||= Pathname.new(__FILE__).dirname.join('../../redis').freeze SOURCE_FILES ||= Dir[LUA_PATHNAME.join('**/*.lua')].compact.freeze DEFINED_METHODS ||= [].freeze SCRIPT_SHAS ||= Concurrent::Map.new module_function extend SingleForwardable - def_delegator :SidekiqUniqueJobs, :connection - - def logger - Sidekiq.logger - end + def_delegators :SidekiqUniqueJobs, :connection, :logger def call(file_name, redis_pool, options = {}) # rubocop:disable MethodLength connection(redis_pool) do |redis| if SCRIPT_SHAS[file_name].nil? SCRIPT_SHAS[file_name] = redis.script(:load, script_source(file_name))