module Sequent::Util
Public Class Methods
Source
# File lib/sequent/util/skip_if_already_processing.rb, line 27 def self.done_processing(processing_key) Thread.current[processing_key] = nil end
Reset the given processing_key
for the current Thread.
Usefull to make a block protected by skip_if_already_processing
reentrant.
Source
# File lib/sequent/util/skip_if_already_processing.rb, line 11 def self.skip_if_already_processing(processing_key) return if Thread.current[processing_key] begin Thread.current[processing_key] = true yield ensure Thread.current[processing_key] = nil end end
Returns if the current Thread is already processing work given the processing_key
otherwise it yields the given +&block+.
Useful in a Queue and Processing strategy