Azure / durabletask

Durable Task Framework allows users to write long running persistent workflows in C# using the async/await capabilities.
Apache License 2.0
1.47k stars 287 forks source link

[WIP] Ensure popReceipt is updated between RenewMessage operations #1065

Open davidmrdavid opened 2 months ago

davidmrdavid commented 2 months ago

In order to update messages on Azure Storage, we need to provide an up-to-date "popReceipt" to the Azure Storage SDK. Otherwise, the request will fail with "404"-type errors. After every message update operation, the popReceipt for a message is updated.

From recent reports, we learned that in the new Azure Storage SDK, the popReceipt of an queueMessage object is not automatically updated in-place when the update API is called. Instead, the update API now returns an updateReceipt object containing the new popRecepit, and leaves the popReceipt in the queueMessage object intact, making it stale.   This suggests that we cannot simply access queueMessage.popReceipt to obtain the latest receipt, instead we'll need to maintain an extra mapping between messageIds and their latest popReceipts. This PR implements a rather naive mapping, but further refinement may be needed.

work in progress

davidmrdavid commented 2 months ago

would be great to add some kind of test to make sure the popReceipt is updated in future releases. This is an invariant we'd expect no matter what.

davidmrdavid commented 2 months ago

note: let's refactor as per this PR (https://github.com/Azure/durabletask/pull/1066 so that we actually update the popReceipt in the SDK queue object. Unclear yet if the PR should be merged as-is, or incorporated here. Needs some thinking.