lib/tasque/task.rb in tasque-0.2.4 vs lib/tasque/task.rb in tasque-0.2.5

- old
+ new

@@ -24,10 +24,15 @@ validates :priority, numericality: { only_integer: true } class << self def do_fetch(type) minimum_priority = Tasque.config.minimum_priority - task = self.with_task(type).to_process.minimum_priority(minimum_priority).lock(true).first + task = self.with_task(type).to_process.minimum_priority(minimum_priority) + task = if Tasque.config.use_mutex && defined?(RedisMutex) + task.lock(true).first + else + task.first + end if task and task.can_pickup? task.pickup task end end