scheduleRepeatedAsyncTask(initialDelay:delay:notifying:_:)

Schedule a repeated asynchronous task to be executed by the EventLoop with a fixed delay between the end and start of each task.

EventLoop.swift:1246
@discardableResult @preconcurrency func scheduleRepeatedAsyncTask(initialDelay: TimeAmount, delay: TimeAmount, notifying promise: EventLoopPromise<Void>? = nil, _ task: @escaping (RepeatedTask) -> EventLoopFuture<Void>) -> RepeatedTask

Parameters

initialDelay

The delay after which the first task is executed.

delay

The delay between the end of one task and the start of the next.

promise

If non-nil, a promise to fulfill when the task is cancelled and all execution is complete.

task

The closure that will be executed. Task will keep repeating regardless of whether the future gets fulfilled with success or error.

  • return: RepeatedTask