-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
QUESTION: Tell pm2 when server is actually ready to handle requests #2353
Comments
You may want to call the .listen function once all your sub applications are ready. PM2 recognize an application as ready once the app calls .listen. You may also want to override the kill timeout: Let me know if it helps, |
So i'm already doing the following:
While tailing all pm2 logs, I see:
As you can see, pm2 says my application is "online" long before I couldn't seem to find where pm2 specifically listens for |
@4storia This behavior is actually only present on cluster mode. @Unitech can we add it to the fork mode without problem ? |
Ah okay, I see. It seems a little misleading that pm2 reports the app as "online" as soon as it begins execution. I understand that pm2 doesn't just run web servers, but it would be great if I could let my app signal to pm2 when it was online, if for no other reason than to have the status from |
@4storia Little update on this, i've done this the past day on this branch, will merge to development soon, you just need to pass |
!! Oh man, thats super awesome! Thanks for looking into that, I really appreciate it. I'll be eagerly awaiting that pr getting merged :D |
quick question - any update on when that branch will get merged back to development? |
@Unitech gonna review it when he's gonna come back from JSConfChina in the next days |
@vmarchaud How come the PR related to this issue was closed? I think a couple of people, me included, were waiting for this to get merged so we can start using it. |
Landed in dev branch of pm2 : |
@4storia Hi, I'm using pm2 to start java/python/binary, I need to implement the equivalent "process.send" in these languages. Is there any easy way to do this ? |
I've looked around the documentation, but I didn't really see any references to this, so my apologies if this is covered somewhere already.
I have a koa app that mounts many sub-apps before coming online. Because it has to require many (around 15) sub-apps, it takes 5-10 seconds to start/restart fully, aka to get to the point where it is actually ready to accept requests. It doesn't seem like pm2 picks up on this fact (not that I would expect it to), and when I do
pm2 reload
, there is a period of time where requests fail, as the application has not yet started listening for requests. Is there a way for me to tell pm2, from my application, that a process is actually "online"? Or is there a suggested workflow for reloading the application (which I'm running in cluster mode) so that my users don't experience downtime during deployments?The text was updated successfully, but these errors were encountered: