Module: ActiveJob::Uniqueness
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/active_job/uniqueness.rb,
lib/active_job/uniqueness/errors.rb,
lib/active_job/uniqueness/version.rb,
lib/active_job/uniqueness/lock_key.rb,
lib/active_job/uniqueness/strategies.rb,
lib/active_job/uniqueness/lock_manager.rb,
lib/active_job/uniqueness/configuration.rb,
lib/active_job/uniqueness/sidekiq_patch.rb,
lib/active_job/uniqueness/log_subscriber.rb,
lib/active_job/uniqueness/strategies/base.rb,
lib/active_job/uniqueness/active_job_patch.rb,
lib/active_job/uniqueness/test_lock_manager.rb,
lib/active_job/uniqueness/strategies/until_expired.rb,
lib/active_job/uniqueness/strategies/until_executed.rb,
lib/active_job/uniqueness/strategies/until_executing.rb,
lib/active_job/uniqueness/strategies/while_executing.rb,
lib/generators/active_job/uniqueness/install_generator.rb,
lib/active_job/uniqueness/strategies/until_and_while_executing.rb
Defined Under Namespace
Modules: ActiveJobPatch, Generators, SidekiqPatch, Strategies
Classes: Configuration, Error, InvalidOnConflictAction, JobNotUnique, LockKey, LockManager, LogSubscriber, StrategyNotFound, TestLockManager
Constant Summary
collapse
- VERSION =
'0.3.2'
Class Method Summary
collapse
Class Method Details
22
23
24
|
# File 'lib/active_job/uniqueness.rb', line 22
def configure
yield config
end
|
.lock_manager ⇒ Object
30
31
32
|
# File 'lib/active_job/uniqueness.rb', line 30
def lock_manager
@lock_manager ||= ActiveJob::Uniqueness::LockManager.new(config.redlock_servers, config.redlock_options)
end
|
.reset_manager! ⇒ Object
42
43
44
|
# File 'lib/active_job/uniqueness.rb', line 42
def reset_manager!
@lock_manager = nil
end
|
.unlock!(**args) ⇒ Object
.unlock_sidekiq_job!(job_data) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/active_job/uniqueness/sidekiq_patch.rb', line 8
def self.unlock_sidekiq_job!(job_data)
return unless job_data['class'] == 'ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper'
job = ActiveJob::Base.deserialize(job_data.fetch('args').first)
return unless job.class.lock_strategy_class
begin
job.send(:deserialize_arguments_if_needed)
rescue ActiveJob::DeserializationError
else
ActiveJob::Uniqueness.unlock!(job_class_name: job.class.name, arguments: job.arguments)
end
end
|