Skip to content

Commit c5ef3a4

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-69629-CronJob-Locking' into Okapis-develop-pr
2 parents 3bb97d1 + 32d399e commit c5ef3a4

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

app/code/Magento/Cron/Model/ResourceModel/Schedule.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ public function _construct()
2323
}
2424

2525
/**
26-
* If job is currently in $currentStatus, set it to $newStatus
27-
* and return true. Otherwise, return false and do not change the job.
28-
* This method is used to implement locking for cron jobs.
26+
* Sets new schedule status only if it's in the expected current status.
27+
*
28+
* If schedule is currently in $currentStatus, set it to $newStatus and
29+
* return true. Otherwise, return false.
2930
*
3031
* @param string $scheduleId
3132
* @param string $newStatus
@@ -47,11 +48,12 @@ public function trySetJobStatusAtomic($scheduleId, $newStatus, $currentStatus)
4748
}
4849

4950
/**
50-
* If job is currently in $currentStatus and there are no existing jobs
51-
* with $newStatus, set it to $newStatus and return true. Otherwise,
52-
* return false and do not change the job.
53-
* This method is used to implement locking for cron jobs that share a
54-
* job code.
51+
* Sets schedule status only if no existing schedules with the same job code
52+
* have that status. This is used to implement locking for cron jobs.
53+
*
54+
* If the schedule is currently in $currentStatus and there are no existing
55+
* schedules with the same job code and $newStatus, set the schedule to
56+
* $newStatus and return true. Otherwise, return false.
5557
*
5658
* @param string $scheduleId
5759
* @param string $newStatus

0 commit comments

Comments
 (0)