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
RepeatedTaskinside 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.
public func cancel(promise: EventLoopPromise<Void>? = nil)