File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,14 @@ class AsyncTask
4747 */
4848 private const LARAVEL_START = "LARAVEL_START " ;
4949
50+ /**
51+ * The time epsilon that will be added to timeout checks to ensure we can correctly handle Unix timeouts.
52+ *
53+ * This is a workaround to the undetectable but inevitable Unix PHP startup delay.
54+ * @var float
55+ */
56+ private const TIME_EPSILON = 0.1 ;
57+
5058 /**
5159 * Indicates whether GNU coreutils is found in the system; in particular, we are looking for the timeout command inside coreutils.
5260 *
@@ -266,7 +274,7 @@ protected function checkTaskTimeout(): void
266274 if ($ this ->laravelStartVal !== null ) {
267275 // we know when we have started; this can be null when running some test cases
268276 $ timeElapsed = microtime (true ) - $ this ->laravelStartVal ;
269- if ($ timeElapsed >= $ this ->timeLimit ) {
277+ if ($ timeElapsed + self :: TIME_EPSILON >= $ this ->timeLimit ) {
270278 // timeout!
271279 $ hasTimedOut = true ;
272280 }
You can’t perform that action at this time.
0 commit comments