Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-51298

Add cancelation support to AsyncTry/until/withDelayBetweenIterations

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • Fully Compatible
    • Service arch 2020-12-28
    • 2

      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.

            Assignee:
            george.wangensteen@mongodb.com George Wangensteen
            Reporter:
            matthew.saltz@mongodb.com Matthew Saltz (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: