-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Promises for commands in flight do not return when the connection is dropped #150
Comments
I got a chance to look at this. I was able to resolve this at the RedisClient level. I did the following
Diff below
@Mordil If this solution is acceptable, I'll create a PR accordingly. Let me know what you think |
@Mordil I created a PR for this. Use it if you desire. I needed to fix it for my needs regardless. |
@ericchapman Sorry for the extremely long delay in response - August has been way too busy for me. I left a comment on the PR of where the code can live. The primary thing is the handler is missing a good implementation for either |
@Mordil That was what I was looking for! I knew the in-flight promises were stored somewhere already. I just needed to go a level deeper in the code. Let me know if my modified code is correct. And no problem being busy. It happens to all of us. |
Hey @Mordil. I am using v3.4.0 (the Vapor 3.0/Redis NIO implementation) and noticed that when requests are in flight and the connection gets dropped, the promise is not getting fulfilled with an error (or anything for that matter), so I never know it happened. The system just hangs.
Easiest way to reproduce is to do a long "brpop" command and kill the connection. You'll see that no error is thrown and no response is received. See below
If I wait the 5 seconds and let the timeout expire, I will get "nil" back as expected. If I kill the connection before that, I get nothing back.
As a workaround, I am going to create a delayed task that will fulfill the promise with an error if I get nothing back by the time it runs, and then cancel it if I do get something back. This feels hacky/expensive but will get the job done for now.
I don't know the NIO code very well, but is there a way to clear out pending promises with an error when the connection closes?
The text was updated successfully, but these errors were encountered: