-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Proposal: Add Delayed Retry Functionality #1465
Comments
cc: @jadekler 🙏 |
Apologies for the delay! After some discussions with other people on the Pub/Sub team, we aren't looking to add delay functionality in the client libraries as of yet. The reasoning is consistent with the discussions in the issues you linked, but more clearly addressed here and in #1147. Essentially, we want this feature to be native to Pub/Sub and not dependent on the client library. This particular issue has been brought up a number of times, so it's definitely on our radar. We keep track of common feature requests like this so they are properly prioritized. In the meantime, you could consider offloading the burden of retrying to another service, like Cloud Tasks. Thanks! |
@hongalex What about at least adding functionality to release these messages from flow control without explicit Looking at this thread, it almost seems like it was made based on one strange use case where a user was acking at the beginning of processing. |
To be clear, what I'm suggesting is allowing users an option to manually release individual messages from flow control. Maybe a reference: #870 (comment) |
Will look more into Cloud Tasks possibility though, thanks for your response. If I can ask one more question, why add retry to PubSub if configurable retry is already possible in CloudTasks? |
@hongalex Is there somewhere I can subscribe to see updates on this? Is this feature available natively in Pub/Sub nowadays? @alyosha Cloud Tasks is unsuitable for interactive applications as the delay may be too high - this is even explicitly noted in their docs. Also, Cloud Tasks is not available in a pull configuration - only push (where Tasks HTTP POSTs to your service). |
@orishoshan @alyosha Sorry for the lack of a response. We have been working on several other new features, so there hasn't been any updates on this yet. In cases like these, we recommend filing a new issue on our Pub/Sub issue tracker, which also keeps track of vote count so it's easier to justify bumping issues up in priority if a lot of people are asking for it |
Proposal
It would be useful if there were a Pubsub-native means of delaying message retry. Currently, the only way to implement something similar is to hold the message outstanding, but this obviously has a negative effect on throughput, etc.
The changes discussed in this issue and introduced from version
0.19.0
were breaking for some users who were not callingAck
orNack
upon return fromReceive
. Prior to these changes, the message was released from flow control upon callback fromReceive
(i.e. not counted towardMaxOutstandingMessages
/MaxOutstandingBytes
). This allowed users to implement a rudimentary, fixed-time retry delay by settingMaxExtension
to the desired retry period and returning without anAck
orNack
call.From
v0.19.0
onwards, messages are not released from flow control untilAck
, meaning they still count toward the max messages/bytes limit if you attempt the above approach. As far as I can see, this means that users have no option but to disable flow control and implement their own semaphore if they wish to maintain a retry delay.The proposed new addition would allow such users an alternative, officially-supported means of implementing the same functionality, with more precision/control.
Calling
Nack
over and over in these cases is not an ideal solution. A good problem statement can be seen in this comment on an issue thread in the Java librarySample Implementation
I forked the github mirror and implemented a version of the functionality I am looking for as a basis for discussion. The proposed changes can be seen here: alyosha#1
Explanation of Proposed Changes
Delay
which can be called on aMessage
pointer receivertime.Duration
, representing the desired period of time to wait before retrying delivery of the messagemsg.Delay(30*time.Second)
Delay
simply sets the unexportedretryDelay
delay field of theMessage
struct to the desired wait periodReceive
, the value of the message'sretryDelay
field is checkedackDeadline
modified based on the providedretryDelay
valuemaxAckDeadline
value of 10 minutes, regardless of the provided duration10m
max)Example use case for this new functionality:
Nack
repeatedly and having the message retry over and over, it would be preferable to delay the message retry by a certain period of time and only try again once that specified duration has passed.Related issue threads
The text was updated successfully, but these errors were encountered: