warp-core-worker
    Preparing search index...

    Interface ITaskInstance<TaskType, TaskProps, ReturnType, CommonTaskContext>

    Task constructor params

    interface ITaskInstance<
        TaskType extends string,
        TaskProps extends TTaskProps,
        ReturnType,
        CommonTaskContext,
    > {
        abortSignal: AbortSignal;
        commonContext: CommonTaskContext;
        data: ReturnType | undefined;
        disabled: boolean;
        end: Date | undefined;
        errorCount: number;
        errors: Set<{ error: Error; ts: Date }>;
        progress: number | undefined;
        props: TaskProps;
        runCount: number;
        runErrorCount: number;
        singleInstance: boolean;
        start: Date | undefined;
        status: TaskStatusType;
        taskError: Error | undefined;
        trigger: TaskTrigger;
        type: TaskType;
        uuid: string;
        allowRestart(): boolean | Promise<boolean>;
        getDescription(): string | Promise<string>;
        onErrorSleep(): number | Promise<number>;
        onInit(): void | Promise<void>;
        onPreStart(): boolean | Promise<boolean>;
        onRejected(): void | Promise<void>;
        onResolved(): void | Promise<void>;
        onUpdate(callback: () => void): void;
        retry(): boolean | Promise<boolean>;
        runTask(): ReturnType | Promise<ReturnType>;
        update(): void;
    }

    Type Parameters

    • TaskType extends string
    • TaskProps extends TTaskProps
    • ReturnType
    • CommonTaskContext

    Hierarchy (View Summary)

    Implemented by

    Index
    abortSignal: AbortSignal
    commonContext: CommonTaskContext
    data: ReturnType | undefined

    task data after runTask

    disabled: boolean
    end: Date | undefined
    errorCount: number

    Current run error count

    errors: Set<{ error: Error; ts: Date }>
    progress: number | undefined

    optional task progress

    props: TaskProps
    runCount: number

    Total run count

    runErrorCount: number

    Total run error count

    singleInstance: boolean

    limit only one instance of this task type

    start: Date | undefined
    taskError: Error | undefined

    this is actual error task did throw

    trigger: TaskTrigger

    task trigger type

    type: TaskType

    task type string

    uuid: string
    • Called before the task is running. how to use:

      • clear old errors
      • validate current props

      Returns boolean | Promise<boolean>

      true if the task should be started

    • Event listener for task update event.

      Parameters

      • callback: () => void

        to call when task is updated

      Returns void