Popii - v0.5.1
    Preparing search index...

    Interface PopiiTaskDefinition<TState>

    The definition of a scheduled background task.

    Use the task builder function to create one with full type inference. Tasks are auto-loaded from src/tasks/ and can also be triggered on demand via pop.schedule("task-name", payload, delayMs).

    interface PopiiTaskDefinition<TState = any> {
        name?: string;
        schedule?: string;
        timezone?: string;
        overlap?: boolean;
        retries?: number;
        retryDelay?: number;
        timeoutMs?: number;
        run(client: PopiiClient<TState>, payload?: any): void | Promise<void>;
    }

    Type Parameters

    • TState = any
    Index

    Methods

    • The function to run. payload is provided when triggered via pop.schedule().

      Parameters

      Returns void | Promise<void>

    Properties

    name?: string

    A unique name for this task. Used when scheduling it via pop.schedule().

    schedule?: string

    Cron expression (e.g. "0 9 * * *" for every day at 9am). Omit for on-demand-only tasks.

    timezone?: string

    IANA timezone name (e.g. "America/New_York"). Defaults to UTC.

    overlap?: boolean

    Allow concurrent runs of this task. Defaults to false (skips if previous run is still active).

    retries?: number

    Number of times to retry on failure. Defaults to 0.

    retryDelay?: number

    Milliseconds to wait between retries. Defaults to 1000.

    timeoutMs?: number

    Maximum execution time in ms before the run is considered timed out.