Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Add IPC disconnect method when using fork #2591

Closed
wants to merge 2 commits into from

Conversation

AndreasMadsen
Copy link
Member

@indutny

This add a disconnect method to the child object (in parent) and in the process object (in child), when using .fork. It allow the child to self terminate since there is no IPC keeping it alive:

It allow the following issues to be fixed:

Please note that is related to #2426, I will update that one when this has landed, but it just made sense to split #2426 up in two pull requests.

This also solves some future issues related to cluster 2.0 (see #2038)


This event will emit after using the `.disconnect()` method in the parent or
in the child. After this event has emitted it is not possible to send messages
to the child or parent. An alternativ way to check if you can send messags

Choose a reason for hiding this comment

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

Fix typos

@indutny
Copy link
Member

indutny commented Jan 24, 2012

lgtm!

@piscisaureus can you please put your word here?

This disconnect method allow the child to die graceful unlike
.kill() there would send a signal and stop the event loop.
This also adds a disconnect event and connect property.
@AndreasMadsen
Copy link
Member Author

@indutny I have made a correction 3e42012, after your final review. Described in commit.

There could be cases where a data chunk would contain a linebreak sign
followed by an unfinched message. This would result in .buffering
to be false. To fix this we detect if length of the JSONbuffer is zero.
@AndreasMadsen
Copy link
Member Author

@indutny Yup, old habit, fixed :)

@AndreasMadsen
Copy link
Member Author

@piscisaureus could you review this, it blocks my cluster work pretty badly.

@piscisaureus
Copy link

Landed in 836344c. Thanks Andreas.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants