Skip to content

Conversation

@nicolas-grekas
Copy link

Currently, the 'exit' event occurs only after some time defined by a periodic timer.
This means a react child-process can't be faster than this timer.
Using this patch, the exit even is triggered as soon as the process exits, which can be way earlier than what is done today.

@WyriHaximus
Copy link
Member

On first sight it looks good to me but I'm slightly worried that when dealing with a lot of data between parent and child process CPU usage will be elevated. Have to test it to be sure but this is the first thing that came to mind. Aside from that 👍 on the PR, 0.1 second is a really long time to wait for something.

src/Process.php Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving the above anonymous function to a (public) checkRunning() (better names welcome) instead?

This way, the user would have more control over when to check the process status. After all, the consumer of this API will probably have a better understanding on when to consider a process dead.

@nicolas-grekas
Copy link
Author

Updated

@nicolas-grekas nicolas-grekas changed the title Use reactive 'exit' event when possible Don't wait for a timer when the process already died Aug 2, 2016
@clue
Copy link
Member

clue commented Mar 10, 2017

I'd like to finally get this in, can you add a test case for this? :shipit:

@nicolas-grekas
Copy link
Author

Continued in #58, thanks @clue for taking over.

@nicolas-grekas nicolas-grekas deleted the exit-as-event branch January 13, 2018 14:13
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.

3 participants