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

Reload plugin preventing cli plugin exit #155

Open
jimisaacs opened this issue Oct 4, 2011 · 4 comments
Open

Reload plugin preventing cli plugin exit #155

jimisaacs opened this issue Oct 4, 2011 · 4 comments

Comments

@jimisaacs
Copy link

I'm not sure what is exactly going on here since I just started testing with the provided cluster examples.
Basically when I add the reload plugin to the cli test, then try to use it as described, it behaves differently than without the reload plugin.

It looks like the reload plugin is somehow preventing the cli plugin from properly exiting the process on say simple:
node cli.js -h

It shows the help, no errors, simply doesn't exit as it does without using the reload plugin.

@jimisaacs
Copy link
Author

I assume fs.watchFile is in use in the reload plugin, and I remember finding out that this keeps the process open the same as opening a socket.

Maybe this is what is happening here?

@tj
Copy link
Contributor

tj commented Oct 4, 2011

could be, probably not a bad idea to duplicate some of the tests with varied configurations

@jimisaacs
Copy link
Author

Ok, so I had a look at the reload plugin and yes, watchFile is in use, so I wondered if it had anything to do with the order plugins are enabled, so switched them around. This isn't the case, because the plugin looks to be invoked immediately with the Master.prototype.use method.

Do you think there a need for a set of deferred plugins? Where these plugins wouldn't be invoked until the cluster actually starts, or some state is entered. This way, if the reload plugin and the cli plugin are both used, the reload plugin will not be invoked at all if we simply want to run a cli option.

There's probably more use cases for this I can't think of right now, but just a thought. I guess this sounds like a plugin api allowing for priority. Might be able to achieve something else just with events and listeners, eg. the plugin is invoked, but the main body of the plugin is simply added as listener for an event emitted by the master.

@jimisaacs jimisaacs reopened this Oct 4, 2011
@jimisaacs
Copy link
Author

I have horrible habit of doing that... (hitting Comment & Close)

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

No branches or pull requests

2 participants