Options
All
  • Public
  • Public/Protected
  • All
Menu

The Worker class is responsible for the execution of scheduling tasks based on events. Each Worker instance is bound to a context. This context could be, for example, a unique Github repository, or a directory in a file system, a specific customer service in a set, etc. It is also generic, and can therefore be of any type. When WorkerEvents are added to an empty queue, they are processed for being worked on in the next tick of event loop.

Type parameters

  • T

Hierarchy

  • Worker

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Creates the Worker class, specifying a context and the parent Map.

    Parameters

    • context: T

      The context to use for hashing.

    • onDone: WorkerRemove<T>

      The method to use to remove a Worker post-event processing.

    Returns Worker

Properties

Private _context

_context: T

Holds the context for the Worker.

Private onDone

onDone: WorkerRemove<T>

Method to call when a Worker is to be removed.

Private queue

queue: WorkerEvent[] = []

Holds the queue of events to work on.

Accessors

context

  • get context(): T
  • Retrieve the context for the Worker.

    Returns T

    The context for the Worker.

Methods

addEvent

Private runWorker

  • runWorker(): void
  • Runs the next worker in the queue, before deleting its entry. Should more entries exist it then runs those.

    Returns void

Generated using TypeDoc