Skip to content

Commit

Permalink
Also handle PHP INI timeout case
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorial1024 committed Dec 30, 2024
1 parent 0367ab4 commit 665ef6a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/AsyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ public function __construct(Closure|AsyncTaskInterface $theTask)
public function run(): void
{
// todo startup configs
// install a timeout detector
// this handles Windoes timeouts, but also Unix timeouts where PHP max_execution_time is set less than the task time limit
register_shutdown_function([$this, 'checkRuntimeTimeout']);
if (OsInfo::isWindows()) {
// windows can just use PHP's time limit
set_time_limit($this->timeLimit);
// then install a timeout detector
register_shutdown_function([$this, 'checkRuntimeTimeout']);
}

// then, execute the task itself
Expand Down

0 comments on commit 665ef6a

Please sign in to comment.