Class Scheduler<Result, Binding, PollingGroups>

A scheduler is a service that manages the execution of tasks in a controlled and efficient way. It is responsible for managing the resources and the rate limits of the tasks, and for emitting events when the tasks are done or when an error occurs.

Type Parameters

Hierarchy

  • EventEmitter
    • Scheduler

Implements

Constructors

Properties

componentId: string = ...

Provider unique identifier for trace purposes

metrics: Registry<"text/plain; version=0.0.4; charset=utf-8"> = ...

Metrics registry

metricsDefinitions: MetricsDefinitions = ...

Metrics definitions

name: string

The name of the scheduler

Accessors

  • get status(): "pass" | "fail" | "warn"
  • Get the health status for the scheduler

    Returns "pass" | "fail" | "warn"

Methods

  • Add a listener for the done event, emitted when a task is done, with the result or the error.

    Parameters

    Returns this

  • Cleanup the scheduler

    Returns void

  • Close the scheduler

    Returns Promise<void>

  • Drop a resource from the scheduler

    Parameters

    • resource: string

      The resource to drop

    Returns void

  • Removes the specified listener from the listener array for the done event.

    Parameters

    Returns this

  • Add a listener for the error event, emitted when the component detects an error.

    Parameters

    • event: "error"

      error event

    • listener: (error: Crash | Error | Multi) => void

      Error event listener

    Returns this

  • Add a listener for the status event, emitted when the component status changes.

    Parameters

    • event: "status"

      status event

    • listener: (status: "pass" | "fail" | "warn") => void

      Status event listener

    Returns this

  • Add a listener for the done event, emitted when a task is done, with the result or the error.

    Parameters

    Returns this

  • Add a listener for the done event, emitted when a task is done, with the result or the error. This is a one-time event, the listener will be removed after the first emission.

    Parameters

    Returns this

  • Removes all listeners, or those of the specified event.

    Parameters

    • Optionalevent: "done"

      done event

    Returns this

  • Removes the specified listener from the listener array for the done event.

    Parameters

    Returns this

  • Start the scheduler

    Returns Promise<void>

  • Stop the scheduler

    Returns Promise<void>