-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
SSE Watcher issues #1744
Comments
Also perhaps relevant, the Mozilla docs on SSE contain this warning. I don't think Crystal has any packaged HTTP2 support yet.
|
As well, I've just come across this. It appears that, since even after disconnect the loop still spins, when a reload event is triggered every open connection which is no longer tied to the browser throws an exception. After the exception is thrown, the loop is obviously terminated. Which (accidentally) mitigates this bug at least a bit. |
Ah ok, I guess my implementation was a little naive when I thought just changing I was already aware of the limitations of SSE, but I know some people swear by it, so I thought it was worth keeping around. I think my new implementation would be to store each request Context in a list, that when a reload should happen, it just pops each one off and runs the reload logic, then only break the loop when the context is closed. We'll see if that works. |
@robacarp would you be willing to try out some of my fixes with your local setup? |
Describe the bug
This could pretty easily fall into the simple territory of a bug we're okay living with.
In development mode, with
lucky watch --watcher=sse
, each time a browser is connected to the SSE server, a new loop is initiated withsleep 0.1
s.Simply clicking around on a site, navigating around pages, it's easy to get this loop spinning dozens of times.
I think this would cause an issue if the lucy dev server is running for a long time, and active development is refreshing the page over and over.
To Reproduce
Steps to reproduce the behavior:
Screenshots/code
I was able to prove that this happens by modifying lib/lucky/tasks/watch.cr like this. After modifying the file,
rm bin/lucky.watch
and thenlucky dev
will compile the task on and run it.Very Verbose Output:
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: