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

How to block until server is ready to listen? #340

Closed
euclio opened this issue May 17, 2016 · 3 comments
Closed

How to block until server is ready to listen? #340

euclio opened this issue May 17, 2016 · 3 comments

Comments

@euclio
Copy link
Contributor

euclio commented May 17, 2016

I'm working on a markdown preview server library that starts a local nickel server to display HTML. I think I'm running into a race condition where it's possible to send requests to the server before it's actually up and running. Since calling server.listen() consumes the current thread, I'm not sure how to actually know when the main thread is able to start sending requests to the server.

Is it possible to do this in the current release? Or does #334 provide a way to do this?

@Ryman
Copy link
Member

Ryman commented May 18, 2016

I think #334 is along the lines of something that you'd need (feel free to let us know if it isn't!). I'm not sure if there's a clean way to do it from within the same process in current master, in our tests we had to spawn subprocesses and read from stdout to handle this kind of thing. (yuck)

@euclio
Copy link
Contributor Author

euclio commented May 20, 2016

Tested out the PR in my project, and it works perfectly! I'll close this issue when the PR is merged.

@kellpossible
Copy link

You going to close this? It looks like it was merged.

@euclio euclio closed this as completed Sep 30, 2016
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

3 participants