Module: utils/runWithAbort

Abortable run helper and abort controller registry.

Encapsulates the AbortController lifecycle, success/failure logging, and error handling that every async pipeline route (crawl, run, generate) repeats.

Exports

  • runWithAbort — Execute an async function with abort support.
  • runAbortControllersMap<runId, { controller: AbortController, run: Object, provider: string|null }> registry.
Source:

Methods

(static) runWithAbort()

Parameters:
Name Type Attributes Description
opts.actorInfo Object <optional>

{ userId, userName } from the triggering request. Spread into the failure logActivity call so the audit trail records who started the run.

opts.onComplete function <optional>

Called after the run reaches any terminal state (completed, failed, or aborted). Receives the run object so callers can inspect final status. Errors thrown by onComplete are silently caught to avoid masking the original run outcome.

Source: