lib/acidic_job/mixin.rb in acidic_job-0.8.2 vs lib/acidic_job/mixin.rb in acidic_job-0.8.3
- old
+ new
@@ -16,10 +16,10 @@
# However, you can customize this behavior on a per job class level
other.define_singleton_method(:acidic_by_job_identifier) { @acidic_identifier = :job_id }
# You could unique job runs by the arguments passed to the job (e.g. memoization)
other.define_singleton_method(:acidic_by_job_arguments) { @acidic_identifier = :job_arguments }
# Or, you could unique jobs run by any logic you'd like using a block
- other.define_singleton_method(:acidic_by) { |&block| @acidic_identifier = block }
+ other.define_singleton_method(:acidic_by) { |proc = nil, &block| @acidic_identifier = proc || block }
# We add a callback to ensure that staged, non-workflow jobs are "finished" after they are "performed".
# This allows us to ensure that we can always inspect whether a run is finished and get correct data
other.set_callback :perform, :after, :finish_staged_job, if: -> { was_staged_job? && !was_workflow_job? }
# We also allow you to write any of your own callbacks keyed to the "finish" event.