@@ -90,6 +90,12 @@ class Config
90
90
* @var int
91
91
*/
92
92
private $ defaultTryDelay ;
93
+ /**
94
+ * If true, the failed task will be restarted without delay for Every/Delay modes,
95
+ * and at the same interval for Single mode (but only at the correct interval)
96
+ * @var bool
97
+ */
98
+ private $ restartImmediately ;
93
99
/**
94
100
* Minimum interval in minutes for task's addInterval method. It is made due to the fact that the scheduler
95
101
* does not guarantee the start of the task at the exact time, and too small interval can lead to a missed task launch.
@@ -120,10 +126,12 @@ class Config
120
126
* {{message}} and {{stacktrace}} variables. Pass null for default formatting:
121
127
* "{{header}}\n[code]: {{code}}\n[exception]: {{class}}\n[message]: {{message}}\n[stacktrace]:\n{{stacktrace}}".
122
128
* @param ?int $maxExceptionMsgLength The maximum length of the exception message (the longer one will be truncated).
129
+ * @param bool $commandOutput If true, output from bash command tasks will be sent to stdout. Otherwise, it will be suppressed.
123
130
* @param bool $defaultPreventOverlapping Determines if an overlapping task can be run launched.
124
131
* @param int $defaultLockResetTimeout Locking reset timeout in minutes (to prevent freezing tasks).
125
132
* @param int $defaultTries The number of attempts to execute the task in case of an error.
126
133
* @param int $defaultTryDelay Delay before new try.
134
+ * @param bool $restartImmediately If true, failed task will be restarted without delay
127
135
* @param int $minimumIntervalLength Minimum interval in minutes for task's addInterval method.
128
136
* ATTENTION: a low value can cause to skipped tasks, change at your own risk.
129
137
* @throws Exception
@@ -144,6 +152,7 @@ public function __construct(
144
152
int $ defaultLockResetTimeout = 360 ,
145
153
int $ defaultTries = 1 ,
146
154
int $ defaultTryDelay = 0 ,
155
+ bool $ restartImmediately = false ,
147
156
int $ minimumIntervalLength = 30
148
157
)
149
158
{
@@ -186,6 +195,8 @@ public function __construct(
186
195
}
187
196
$ this ->defaultTryDelay = $ defaultTryDelay ;
188
197
198
+ $ this ->restartImmediately = $ restartImmediately ;
199
+
189
200
if ($ minimumIntervalLength <= 0 ) {
190
201
throw new Exception ('The minimum interval must be greater than zero. ' );
191
202
}
@@ -338,6 +349,16 @@ public function getDefaultTryDelay(): int
338
349
return $ this ->defaultTryDelay ;
339
350
}
340
351
352
+ /**
353
+ * If true, the failed task will be restarted without delay for Every/Delay modes,
354
+ * and at the same interval for Single mode (but only at the correct interval)
355
+ * @return bool
356
+ */
357
+ public function getRestartImmediately (): bool
358
+ {
359
+ return $ this ->restartImmediately ;
360
+ }
361
+
341
362
/**
342
363
* Minimum interval in minutes for task's addInterval method. It is made due to the fact that the scheduler
343
364
* does not guarantee the start of the task at the exact time, and too small interval can lead to a missed task launch.
0 commit comments