Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stop() method to Process and Pool #52959

Merged

Conversation

MiniCodeMonkey
Copy link
Contributor

@MiniCodeMonkey MiniCodeMonkey commented Sep 27, 2024

I had a process pool:

$this->pool = Process::pool(function (Pool $pool) {
    $pool->path(base_path())->command('sleep 5');
    $pool->path(base_path())->command('sleep 10');
})->start();

And I needed to stop all processes in the pool gracefully if they were running.

I was reaching for:

$this->pool->stop()

...which didn't exist, so I decided to add it.

We already have $this->pool->signal(...), but the Symfony stop() method adds some additional logic to ensure that the process is gracefully shut down (if possible): https://github.com/symfony/process/blob/7.1/Process.php#L908-L935

There doesn't seem to be any relevant test cases to add here, the main thing is the actual logic if stop() which is covered by https://github.com/symfony/process/blob/7.1/Tests/ProcessTest.php#L130

@taylorotwell taylorotwell merged commit e1f1cde into laravel:11.x Sep 27, 2024
23 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants