UNPKG

@creejs/commons-retrier

Version:
31 lines (30 loc) 1.32 kB
/** * @typedef {import('./retrier.js').default} Retrier */ export default class AlwaysTask extends Task { /** * Checks if the given task is an instance of AlwaysTask. * @param {*} task - The task to check. * @returns {boolean} True if the task is an instance of AlwaysTask, false otherwise. */ static isAlwaysTask(task: any): boolean; /** * Creates an AlwaysTask instance. * @param {Retrier} retrier - The retrier instance to use for retry logic * @param {Function} task - The task function to execute * @param {boolean} resetRetryPolicyAfterSuccess - Whether to reset retry policy after successful execution */ constructor(retrier: Retrier, task: Function, resetRetryPolicyAfterSuccess: boolean); resetPolicy: boolean; /** * Executes the task with the given retry parameters. * @param {number} retries - The number of retries attempted so far. * @param {number} latence - The current latency ms. * @param {number} nextInterval - The next interval ms. * @returns {Promise<*>} The result of the task execution. */ execute(retries: number, latence: number, nextInterval: number): Promise<any>; } export { AlwaysTask as AlwaysTaskType }; export type Retrier = import("./retrier.js").default; import Task from './task.js';