lib/pigeon/engine.rb
def task_lock(task_name)
    @task_lock.synchronize do
      @task_locks[task_name] ||= Mutex.new
    end
    
    return if (@task_locks[task_name].locked?)
    
    @task_locks[task_name].synchronize do
      yield if (block_given?)
    end
  end
# This is a somewhat naive locking mechanism that may break down
# when two requests are fired off within a nearly identical period.
# For now, this achieves a general purpose solution that should work
# under most circumstances. Refactor later to improve.
This is a somewhat naive locking mechanism that may break down
when two requests are fired off within a nearly identical period.
For now, this achieves a general purpose solution that should work
under most circumstances. Refactor later to improve.
This is a somewhat naive locking mechanism that may break down when two requests are fired off within a nearly identical period . For now this achieves a general purpose solution that should work under most circumstances . Refactor later to improve .
def task_lock(task_name)
    @task_lock.synchronize do
      @task_locks[task_name] ||= Mutex.new
    end
    return if (@task_locks[task_name].locked?)
    @task_locks[task_name].synchronize do
      yield if (block_given?)
    end
  end
def task_lock ( task_name ) @task_lock . synchronize do @task_locks [ task_name ] ||= Mutex . new end return if ( @task_locks [ task_name ] . locked? ) @task_locks [ task_name ] . synchronize do yield if ( block_given? ) end end
This is a somewhat naive locking mechanism that may break down
when two requests are fired off within a nearly identical period.
This is a somewhat naive locking mechanism that may break down when two requests are fired off within a nearly identical period .
task_name