Skip to content

Commit df23688

Browse files
bygaddmarcelklehr
authored andcommitted
docs(taskprocessing): document lockTask semantic change
Per review feedback: note in the lockTask docblock that the guard changed from `status != RUNNING` to `status = SCHEDULED`, and that callers must now treat a 0 return as "the task is no longer claimable" rather than assuming success. Signed-off-by: Yoan Bozhilov <bygadd@gmail.com> Assisted-by: Claude Code:claude-opus-4-8
1 parent 022531b commit df23688

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/private/TaskProcessing/Db/TaskMapper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ public function update(Entity $entity): Entity {
381381
* worker receives the task already RUNNING, so the later SCHEDULED -> RUNNING edge in
382382
* Manager::setTaskStatus (which used to set started_at) no longer fires.
383383
*
384+
* Semantic change: this previously guarded on `status != RUNNING`, which allowed an
385+
* already SUCCESSFUL/FAILED task to be re-locked back to RUNNING. Callers must now
386+
* treat a 0 return as "the task is no longer claimable" (it is no longer SCHEDULED)
387+
* and move on, rather than assuming the lock succeeded.
388+
*
384389
* @return int Number of rows updated: 1 if the task was claimed, 0 if it was no longer scheduled.
385390
*/
386391
public function lockTask(Entity $entity): int {

0 commit comments

Comments
 (0)