lib/delayed/backend/active_record.rb
def lock_exclusively!(worker)
          now = self.class.db_time_now
          # We don't own this job so we will update the locked_by name and the locked_at
          affected_rows = self.class.where("id=? AND locked_at IS NULL AND run_at<=?", self, now).update_all(
            locked_at: now, locked_by: worker
          )
          if affected_rows == 1
            mark_as_locked!(now, worker)
            true
          else
            false
          end
        end
# Lock this job for this worker.
# Returns true if we have the lock, false otherwise.
#
# It's important to note that for performance reasons, this method does
# not re-check the strand constraints -- so you could manually lock a
# job using this method that isn't the next to run on its strand.
Lock this job for this worker.
Returns true if we have the lock, false otherwise.

It's important to note that for performance reasons, this method does
not re-check the strand constraints -- so you could manually lock a
job using this method that isn't the next to run on its strand.
Lock this job for this worker . Returns true if we have the lock false otherwise . It ' s important to note that for performance reasons this method does not re - check the strand constraints -- so you could manually lock a job using this method that isn ' t the next to run on its strand .
def lock_exclusively!(worker)
          now = self.class.db_time_now
          affected_rows = self.class.where("id=? AND locked_at IS NULL AND run_at<=?", self, now).update_all(
            locked_at: now, locked_by: worker
          )
          if affected_rows == 1
            mark_as_locked!(now, worker)
            true
          else
            false
          end
        end
def lock_exclusively! ( worker ) now = self . class . db_time_now affected_rows = self . class . where ( "id=? AND locked_at IS NULL AND run_at<=?" , self , now ) . update_all ( locked_at : now , locked_by : worker ) if affected_rows == 1 mark_as_locked! ( now , worker ) true else false end end
Lock this job for this worker.
Lock this job for this worker .
# We don't own this job so we will update the locked_by name and the locked_at
worker