Skip to content

Commit 27d08cd

Browse files
committed
fix: keep stale job timeout as optional param to avoid breaking change
1 parent 7e40f04 commit 27d08cd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

Classes/Domain/AbstractScheduler.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,19 @@ public function activity(ScheduledJob $job): void
283283
* Reset stale jobs that have not changed for too long.
284284
*
285285
* @param string $groupName Free jobs in this group only
286+
* @param int|null $minutes Only free jobs that are stale for at least this many minutes. @deprecated Use staleJobTimeout configuration setting instead.
286287
* @throws Exception
287288
* @return int Number of freed jobs
288289
*/
289-
public function resetStaleJobs(string $groupName): int {
290+
public function resetStaleJobs(
291+
string $groupName,
292+
?int $minutes = null
293+
): int {
290294
return $this->dbal->executeQuery(
291295
sql: static::RESET_STALE_JOBS_QUERY,
292296
params: [
293297
'groupName' => $groupName,
294-
'seconds' => max($this->staleJobTimeoutSecs, 1),
298+
'seconds' => max($minutes === null ? $this->staleJobTimeoutSecs : $minutes * 60, 1),
295299
],
296300
types: [
297301
'groupName' => Types::STRING,

Classes/Domain/Scheduler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function fail(ScheduledJob $job, string $reason): void;
2323

2424
public function activity(ScheduledJob $job): void;
2525

26-
public function resetStaleJobs(string $groupName): int;
26+
public function resetStaleJobs(string $groupName, ?int $minutes = null): int;
2727

2828
public function getConnection(): Connection;
2929

0 commit comments

Comments
 (0)