Skip to main content

@terascope/job-components / index / EventLoop

Class: EventLoop

A simple class for detecting when the event loop is blocked. The recommend use is to call EventLoop.init(logger) and then await EventLoop.wait() where you want to slow down potentially long running synchronous code

Constructors

new EventLoop()

new EventLoop(logger): EventLoop

Parameters

ParameterType
loggerLogger

Returns

EventLoop

Source

packages/utils/dist/src/event-loop.d.ts:26

Properties

checkedInDiff

checkedInDiff: number

Source

packages/utils/dist/src/event-loop.d.ts:22


logger

readonly logger: Logger

Source

packages/utils/dist/src/event-loop.d.ts:9


DEFAULT_HEARTBEAT

static DEFAULT_HEARTBEAT: number

Source

packages/utils/dist/src/event-loop.d.ts:10

Accessors

blocked

get blocked(): boolean

Returns

boolean

Source

packages/utils/dist/src/event-loop.d.ts:27

Methods

cancel()

cancel(): void

Cancel the event loop checker

Returns

void

Source

packages/utils/dist/src/event-loop.d.ts:31


init()

static init(logger): EventLoop

Creates or replaces an instead of a global EvenLoop

Parameters

ParameterType
loggerLogger

Returns

EventLoop

Source

packages/utils/dist/src/event-loop.d.ts:21


wait()

static wait(): void | Promise<void>

Adds a setTimeout if the event loop is blocked and will the delay will get slower the longer the event loop is block (with an upper limit)

Returns

void | Promise<void>

Source

packages/utils/dist/src/event-loop.d.ts:16