-
-
Notifications
You must be signed in to change notification settings - Fork 796
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
Websocket Handler Creation Timing #766
Comments
hey @nalanj thanks for reporting the issue! That being said, it shouldn't cause any issues. Out of curiosity, what's the edge case you are experiencing? |
I'm persisting database connections and that was leading to issues within http handlers because they were creating a new handler on each request and eventually requests would run out of connections. I put some offline only logic in to clean those up, but at that point I saw the opposite issue with socket handlers because the connection would get cleaned up before the socket handler was done running. On reading through the code it looks like a handler should get created each time a socket message comes in rather than up front - does that seem correct? |
handlers should be created only once, on usage. what you might be experiencing is that when you edit the code it will reload the handler, which I think is the cause for a lot of problems. I think in the next major version we should remove the auto-reload, and make that an option, instead of the default. could you try setting
yes and no. handlers should get loaded and created when they are being called, like AWS does, but they should stay "loaded", at least for a certain amount of time, like AWS does as well. |
@nalanj I just tried to reproduce #798 and found out that the require cache invalidation on each equest causes this to happen. you can read more here: #798 (comment) could you let me know if |
From usage and reading the code, it seems that websocket handlers are created on startup instead of on first usage, but handlers for http endpoints seem to be created on usage. That took me into a weird edge case with persisting db connections, so I wanted to check in on if that's the expected, desired behavior or if it's something you'd like to see change in the future.
The text was updated successfully, but these errors were encountered: