@100mslive/hms-video-store
Version:
@100mslive Core SDK which abstracts the complexities of webRTC while providing a reactive store for data management with a unidirectional data flow
39 lines (38 loc) • 1.35 kB
TypeScript
import { TransportFailureCategory as TFC } from './models/TransportFailureCategory';
import { TransportState } from './models/TransportState';
import { HMSException } from '../error/HMSException';
/**
* Task which is executed by [RetryScheduler.schedule] until max retry count
* is reached.
*
* Any exception raised while executing the task assumes that task is failed.
* Failed tasks are retried if max retry count is not reached.
*
* @returns True if the task if successful, otherwise False
*
*
*/
declare type RetryTask = () => Promise<boolean>;
interface ScheduleTaskParams {
category: TFC;
error: HMSException;
task: RetryTask;
originalState: TransportState;
maxRetryTime?: number;
changeState?: boolean;
}
export declare class RetryScheduler {
private onStateChange;
private sendEvent;
private readonly TAG;
private inProgress;
private retryTaskIds;
constructor(onStateChange: (state: TransportState, error?: HMSException) => Promise<void>, sendEvent: (error: HMSException, category: TFC) => void);
schedule({ category, error, task, originalState, maxRetryTime, changeState, }: ScheduleTaskParams): Promise<void>;
reset(): void;
isTaskInProgress(category: TFC): boolean;
private scheduleTask;
private getDelayForRetryCount;
private setTimeoutPromise;
}
export {};