Zum Inhalt springen
Deutsch

ThrottleOptionsBuilder

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Defined in: src/ThrottleOptions.ts:56

Fluent builder for ThrottleOptionsType:

const throttleOptions = ThrottleOptions.create()
.withQps(10)
.withBurst(2)
.withOnExcess('drop');
this.context.throttle(throttleOptions);

new ThrottleOptionsBuilder(): ThrottleOptionsBuilder

ThrottleOptionsBuilder

OptionsBuilder.constructor

build(): Partial<T>

Defined in: src/util/OptionsBuilder.ts:51

Snapshot the set fields as an independent Partial<T> (own props only).

Partial<T>

OptionsBuilder.build


withBurst(burst): this

Defined in: src/ThrottleOptions.ts:68

Bucket capacity. Default: qps (one second of refill).

number

this


withClock(clock): this

Defined in: src/ThrottleOptions.ts:83

Where the throttle reads the time. Default: the wall clock.

Pass system.clock and a ManualScheduler drives the bucket’s refill, so a throttling test advances time instead of waiting for it.

Clock

this


withOnExcess(onExcess): this

Defined in: src/ThrottleOptions.ts:73

What to do when the bucket is empty. Default: 'pause'.

ThrottleOnExcess

this


withQps(qps): this

Defined in: src/ThrottleOptions.ts:63

Token-refill rate, tokens per second (> 0). Infinity removes the throttle.

number

this


static create(): ThrottleOptionsBuilder

Defined in: src/ThrottleOptions.ts:58

Start a fresh builder. Equivalent to new ThrottleOptionsBuilder().

ThrottleOptionsBuilder