You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,24 @@ $task->start();
69
69
// the task is now run in another PHP process, and will not report back to this PHP process.
70
70
```
71
71
72
+
### Task time limits
73
+
You can set task time limits before you start them, but you cannot change them after the tasks are started. When the time limit is reached, the async task is killed.
74
+
75
+
The default time limit is 30 real seconds. You can also choose to not set any time limit, in this case the (CLI) PHP `max_execution_time` directive will control the time limit.
76
+
77
+
Note: `AsyncTaskInterface` contains an implementable method `handleTimeout` for you to define timeout-related cleanups (e.g. write to some log that the task has timed out). This method is still called when the PHP `max_execution_time` directive is triggered.
78
+
79
+
```php
80
+
// start with the default time limit...
81
+
$task->start();
82
+
83
+
// start task with a different time limit...
84
+
$task->withTimeLimit(15)->start();
85
+
86
+
// ...or not have any limits at all (beware of orphaned processes!)
0 commit comments