-
Notifications
You must be signed in to change notification settings - Fork 11
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
Race condition between can-serve and live-reload #62
Comments
When is that the case? I would think until you pull the page up in your browser live-reload should be up and running? The problem is that we have to have the rather hacky way of spinning up live-reload as a child process (see https://github.com/canjs/can-ssr/blob/master/bin/can-serve#L31) because we can't load the app a second time (#42). If there would be some way to share the loaded application between ssr and live-reload we could wait until the live-reload server is listening. |
live-reload happens in the server code as well. The browser will still live-reload but the server will not, if can-serve loads before the live-reload server is started. |
Ah ok. We could have live-reload print out that it is listening and wait for that before starting the server. The right fix however would be to share the application and run everything in the same process. |
live-reload does print out what port it is listening on. That is the fix I was thinking of as well. |
I'm going to take this one, will wait for the message to be printed. |
That sounds like a dangerous fix |
Let's talk about this before resorting this. I'd much rather make can-serve re-try the connection to live-reload after a short timeout. It might miss messages, but that's ok. |
I can listen to the |
This uses the new retry capability added in stealjs/live-reload#18 Sets liveReloadAttempts to 3, so there will be 2 retries after the connection fails to establish. Fixes #62
Since can-serve and live-reload are launched at the same time, if can-serve loads the application first it will try to send a WebSocket request to the live-reload server which hasn't started yet. We need to wait until the live-reload server is ready before trying to start can-serve.
The text was updated successfully, but these errors were encountered: