Skip to content

Commit 16f73c8

Browse files
committed
Rename "Restart immediately" to "Restart After Fail"
1 parent 672635c commit 16f73c8

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ Some options for setting default task options. The parameters specified in the t
316316

317317
#### Others
318318

319-
* `$restartImmediately` (default `false`) - If true, the failed task will be restarted without delay for Every/Delay
319+
* `$restartAfterFail` (default `false`) - If true, the failed task will be restarted without delay for Every/Delay
320320
modes, and at the same interval for Single mode (but only at the correct interval).
321321
* ```$minimumIntervalLength``` (default ```30```) - Minimum interval size in minutes (for task
322322
method ```addInterval()```). Currently, tasks are started sequentially and synchronously, so the scheduler cannot

src/Config.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Config
9595
* and at the same interval for Single mode (but only at the correct interval)
9696
* @var bool
9797
*/
98-
private $restartImmediately;
98+
private $restartAfterFail;
9999
/**
100100
* Minimum interval in minutes for task's addInterval method. It is made due to the fact that the scheduler
101101
* does not guarantee the start of the task at the exact time, and too small interval can lead to a missed task launch.
@@ -131,7 +131,7 @@ class Config
131131
* @param int $defaultLockResetTimeout Locking reset timeout in minutes (to prevent freezing tasks).
132132
* @param int $defaultTries The number of attempts to execute the task in case of an error.
133133
* @param int $defaultTryDelay Delay before new try.
134-
* @param bool $restartImmediately If true, failed task will be restarted without delay
134+
* @param bool $restartAfterFail If true, failed task will be restarted without delay
135135
* @param int $minimumIntervalLength Minimum interval in minutes for task's addInterval method.
136136
* ATTENTION: a low value can cause to skipped tasks, change at your own risk.
137137
* @throws Exception
@@ -152,7 +152,7 @@ public function __construct(
152152
int $defaultLockResetTimeout = 360,
153153
int $defaultTries = 1,
154154
int $defaultTryDelay = 0,
155-
bool $restartImmediately = false,
155+
bool $restartAfterFail = false,
156156
int $minimumIntervalLength = 30
157157
)
158158
{
@@ -195,7 +195,7 @@ public function __construct(
195195
}
196196
$this->defaultTryDelay = $defaultTryDelay;
197197

198-
$this->restartImmediately = $restartImmediately;
198+
$this->restartAfterFail = $restartAfterFail;
199199

200200
if ($minimumIntervalLength <= 0) {
201201
throw new Exception('The minimum interval must be greater than zero.');
@@ -354,9 +354,9 @@ public function getDefaultTryDelay(): int
354354
* and at the same interval for Single mode (but only at the correct interval)
355355
* @return bool
356356
*/
357-
public function getRestartImmediately(): bool
357+
public function getRestartAfterFail(): bool
358358
{
359-
return $this->restartImmediately;
359+
return $this->restartAfterFail;
360360
}
361361

362362
/**

src/Wrapper/TaskWrapper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function dispatch(): void
109109
return;
110110
}
111111

112-
if (!$lastLaunch->isWorking && $lastLaunch->errorCount !== 0 && $this->config->getRestartImmediately()) {
112+
if (!$lastLaunch->isWorking && $lastLaunch->errorCount !== 0 && $this->config->getRestartAfterFail()) {
113113
$this->logDebug("The previous launch failed after $lastLaunch->errorCount tries. Restart.");
114114
$this->launchTask($startTime);
115115
return;

0 commit comments

Comments
 (0)