Skip to content

API reference / @jsprismarine/chunkgen / ConcurrencyGovernor

Class: ConcurrencyGovernor ​

Defined in: ConcurrencyGovernor.ts:42

A controller for the background concurrency limit. Pure: it reads no clock of its own.

Constructors ​

Constructor ​

new ConcurrencyGovernor(options): ConcurrencyGovernor

Defined in: ConcurrencyGovernor.ts:53

Parameters ​

options ​

ConcurrencyGovernorOptions

Returns ​

ConcurrencyGovernor

Accessors ​

active ​

Get Signature ​

get active(): number

Defined in: ConcurrencyGovernor.ts:64

How many background tasks are allowed right now.

Returns ​

number

Methods ​

observe() ​

observe(signal, nowMs): number

Defined in: ConcurrencyGovernor.ts:75

Feeds the governor one reading.

Parameters ​

signal ​

GovernorSignal

The latest tick lateness and, when known, the throttle growth.

nowMs ​

number

The time of the reading, from any monotonic clock the caller keeps.

Returns ​

number

The limit after this reading.