[SERVER-51298] Add cancelation support to AsyncTry/until/withDelayBetweenIterations Created: 01/Oct/20  Updated: 29/Oct/23  Resolved: 16/Dec/20

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Task Priority: Major - P3
Reporter: Matthew Saltz (Inactive) Assignee: George Wangensteen
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-51284 Add variant of TaskExecutor::schedule... Closed
is depended on by SERVER-50342 Make version of Shard::runCommand tha... Open
Backwards Compatibility: Fully Compatible
Sprint: Service arch 2020-12-28
Participants:
Story Points: 2

 Description   

The asynchronous looping utility AsyncTry supports the ability to wait in between iterations for some amount of time. This wait should be cancelable with CancelationTokens. One way to do that would be to add a CancelationToken to these function signatures, and then instead of future_util::sleepUntil, use TaskExecutor::sleepUntil which accepts CancelationTokens.

Another would be to add a withCancelation function, but then that raises a question of when it should be possible to add this and whether we should always check it along with shouldStopIteration. I'm inclined to go the first route since it's easy enough to check the cancelation token in the until clause if the user wants to do that, and this is mainly to be able to cancel that deadline.



 Comments   
Comment by Githook User [ 10/Dec/20 ]

Author:

{'name': 'George Wangensteen', 'email': 'george.wangensteen@mongodb.com', 'username': 'gewa24'}

Message: SERVER-51298 Add cancelation support to AsyncTry/until looping utility
Branch: master
https://github.com/mongodb/mongo/commit/261562fe64fac903ff1da27de429cdc395bf308d

Generated at Thu Feb 08 05:25:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.