Beignet API reference
    Preparing search index...

    Interface InlineJobDispatcherOptions<Ctx>

    Options for the inline job dispatcher.

    interface InlineJobDispatcherOptions<Ctx> {
        ctx?: Ctx | (() => MaybePromise<Ctx>);
        hooks?: readonly (
            (
                args: JobHookArgs<JobDef<string, StandardSchema, Ctx>, Ctx>,
                next: () => Promise<void>,
            ) => MaybePromise<void>
        )[];
        onError?: (
            error: unknown,
            job: JobDef<string, StandardSchema, Ctx>,
        ) => void;
        retry?: boolean;
        sleep?: (ms: number) => Promise<void>;
    }

    Type Parameters

    • Ctx
    Index
    ctx?: Ctx | (() => MaybePromise<Ctx>)

    Static job context or factory evaluated for each dispatched job.

    hooks?: readonly (
        (
            args: JobHookArgs<JobDef<string, StandardSchema, Ctx>, Ctx>,
            next: () => Promise<void>,
        ) => MaybePromise<void>
    )[]

    Hooks that wrap every job attempt executed by this dispatcher. Runner hooks wrap job-local hooks.

    onError?: (error: unknown, job: JobDef<string, StandardSchema, Ctx>) => void

    Called when a dispatched inline job fails all attempts allowed by its retry policy. When omitted, the final error is rethrown to the caller.

    retry?: boolean

    Honor the job's declared retry policy inline. Defaults to true. Set false when another layer owns execution retries for every dispatch through this dispatcher.

    sleep?: (ms: number) => Promise<void>

    Sleep implementation used between retry attempts. Defaults to a real setTimeout delay; inject a fake in tests to keep retries instant.