RepeatedTask
public final class RepeatedTask
Returned once a task was scheduled to be repeatedly executed on the EventLoop
.
A RepeatedTask
allows the user to cancel()
the repeated scheduling of further tasks.
-
Try to cancel the execution of the repeated task.
Whether the execution of the task is immediately canceled depends on whether the execution of a task has already begun. This means immediate cancellation is not guaranteed.
The safest way to cancel is by using the passed reference of
RepeatedTask
inside the task closure.If the promise parameter is not
nil
, the passed promise is fulfilled when cancellation is complete. Passing a promise does not prevent fulfillment of any promise provided on original task creation.Declaration
Swift
public func cancel(promise: EventLoopPromise<Void>? = nil)