-
Notifications
You must be signed in to change notification settings - Fork 126
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
Allow users to cancel requests #105
base: master
Are you sure you want to change the base?
Conversation
Quick question regarding the timeout: do you expect a use-case, in which this would be useful? The I've actually been wanting to integrate contexts for a while. I also though we could potentially pass down the top-level callback through that context, which would save us a mutex and some management headaches in the I'd love to test & integrate this, once it's ready to go. |
I think the |
24ecdea
to
2280e8e
Compare
Not exactly. If the client is disconnected from the server, then the dispatcher is paused, as you correctly pointed out. This leads to requests not being canceled but staying in the queue until they are eventually delivered. The |
I stand corrected: the timeout policy on the dispatcher currently doesn't use the value from the I had planned to have the dispatcher use the |
2280e8e
to
a9dd40f
Compare
In particular, the websocket I think with this PR or some variation of it, the existing |
Correct. The idea was to give some support to charge points, that have poor/intermittent connection in the first place. Causing a timeout, while the connection is interrupted, seems very annoying (at least that's some feedback I had previously received). Willing to change this behavior ofc.
That What if we added the context to the base Btw, don't get me wrong, I definitely want to integrate this PR somehow, just trying to find a good compromise for usability, while not disrupting the interface. |
I personally like having the |
I can definitely see that being useful. I suppose as a charge point in most cases, there's nothing to do except wait on the connection whereas for my use case, I can take different actions based on whether or not the client request has made it to the central system in some amount of time. |
The reason for introducing this is the potentially unexpected behavior around reconnect attempts and timeouts. If the client disconnects and begins attempting to reconnect, it pauses the current request timeout (and will also therefore never timeout any additional pending requests).
I think it's important to be able to allow canceling or setting an absolute timeout for requests (here via
context.WithTimeout
).Otherwise, the user has no way of reacting to the fact that their requests aren't making it and may never make it to the central system (and also making sure they don't then get sent once the server connection is reestablished, thus the check before the
Write
call).WDYT?