Skip to main content

@webda/coreReadme | API


Function: WaitFor()

WaitFor<T>(callback, retries, title?, logger?, delayer?): Promise<T>

Wait for an operation to end

Some AWS Api require minutes and polling This method will call the callback function until it returns true, or the max retries has been reached. Between each call, it will wait the delay

If it reaches the max retries without a good answer from callback, the Promise will be rejected

Type parameters

T = any

Parameters

callback: (resolve, reject?) => Promise<boolean>

to call between each call

retries: number

max number of retries

title?: string

to display

logger?: Logger

logger to use to report

delayer?: WaitDelayer

function that return pause between each call default to WaitExponential(1000)

Returns

Promise<T>

Source

packages/core/src/utils/waiter.ts:100