-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add returnImmediately option to PubSub's pullAsync #1304
Conversation
I think introducing the concept of I think that the issue that Couldn't we set the timeout to infinite in that particular VTKIT call? If not, then I assume we can catch this failure and pull again? |
I agree in principle but this has been requested by several users. Also I don't see what cancelling the future has to to with exposing
What is the "get timeout"?
I am not sure you can set the timeout for only some of VTKIT |
It is true that you can't set a timeout for a specific instance of a call, but there is a hack available: create a second instead of PublisherApi, sharing the same channel, but with different timeout settings. I don't know that it makes sense to change the spi layer's semantics for this case. If we wanted to handle the described scenario, we would need special-case logic for populating the correct response when returnImmediately was false (timeout -> empty response) but normal logic when returnImmediately was true (timeout -> exception). Maybe we should just make it easier to have call-specific timeout overrides. |
Was it requested because of the timeout issue? Personally, I would create an issue and ask for votes, as personally I see more cons than pros. One could "mimic"
Using @garrettjonesgoogle seems fine to me but as I mentioned I think you have another implementation option to deal with this issue. |
So are you suggesting that instead of having the
Retrying is an option but that makes the use of |
Yes, that was my original intent for asyncPull (sorry if that was never communicated). However,
OK, I don't like it (for the reasons mentioned above, and bellow), but do what you feel right.
Yes, I get that. Maybe I should not have mentioned it. I was just saying that if you bail your future sooner than the RPC timeout you may never see the RPC timeout.
Ideally, but not necessarily (which is another reason I favored hiding it from async pull).
You could use a separate SPI instance just for async pulls (or use the retry as suggested).
Yes, I get your point and that is a price to pay if there is no other way (but I think there is). I also think that when someone is using async pull it is much more likely that they want to wait until there is a message back (or they decide to bail/cancel). What do you think would be the common use-case for a user to do once async pull completes due to an RPC deadline? If you still think that this is an issue and if there is no way to deal with it with a separate settings (e.g. for now use a separate SPI instance) then maybe adding |
For background: Pub/Sub can return an empty list of messages when This behavior is not documented in the official docs which just state:
|
This is replaced by #1387 |
This fixes #1157 and #1299
@aozarov @GarrettJones I would like your opinion on the following:
pullAsync
throwsDEADLINE_EXCEEDED
when a timeout is reached (e.g.PubSubOptions.Builder.initialTimeout()
). This still applies when thePullOption.returnImmediately(false)
option is provided. I have the feeling that this is kind of unexpected as users that provide thePullOption.returnImmediately(false)
option might not wantpullAsync
to be interrupted by timeouts. What do you think? Do you also feel that throwing on timeouts is an unexpected behavior whenPullOption.returnImmediately(false)
is passed?@garrettjonesgoogle is there anything we can do at the Veneer Toolkit layer to avoid failing on timeouts when
PullRequest.getReturnImmediately() == false
?