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

Is it possible to require process.send("online") before it goes online? #1234

Closed
owenallenaz opened this issue May 4, 2015 · 4 comments
Closed

Comments

@owenallenaz
Copy link

From the docs on graceful reload I see there is a way to nofity pm2 for non-http type processes that the process is online via a process.send('online'). Would it be possible to have a configuration setting that requires that to be sent in order for a process to be considered booted in all circumstances, and not just in graceful reloads.

This makes it very clear as developer where in the code you are notifying pm2 that your process is operational. In example, right now with graceful reload, pm2 assumes that my process is ready when it starts listening on something, but what if my process needs to listen to multiple things before it's "booted". In addition, when I first start it up I want to tell pm2 when I consider this boot a success. It's sort of an explicit over implicit type issue.

@owenallenaz owenallenaz changed the title Is it possible require process.send("online") before it goes online? Is it possible to require process.send("online") before it goes online? May 4, 2015
@adrian-ludwig
Copy link

+1

@jshkurti
Copy link
Contributor

jshkurti commented May 5, 2015

I get it. We have to think about it in order to avoid losing usability for the rest of the users. Also there is maybe a workaround : stop the 'listen' event to be fired automatically and fire it manually when your process is ready.

@michaelBenin
Copy link

+1

@Unitech
Copy link
Owner

Unitech commented Oct 31, 2016

$ pm2 start app.js --wait-ready --listen-timeout 15000

In your code, once your application is ready, do process.send('ready')

Available in pm2@next:

$ npm install pm2@next -g
$ pm2 update

@Unitech Unitech closed this as completed Oct 31, 2016
@7596ff 7596ff mentioned this issue Nov 10, 2016
This was referenced May 22, 2017
@ysoffner ysoffner mentioned this issue Feb 23, 2018
This was referenced Mar 26, 2021
@kurtfurbush kurtfurbush mentioned this issue Nov 5, 2021
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

5 participants