Options
All
  • Public
  • Public/Protected
  • All
Menu

Module IPoll<T, U, V>

A namespace for IPoll types.

Type parameters

  • T

    The resolved type of the factory's promises.

  • U

    The rejected type of the factory's promises.

  • V: string

    The type to extend the phases supported by a poll.

Hierarchy

  • IPoll

Implemented by

Index

Type aliases

Frequency

Frequency: object

The polling frequency parameters.

Notes

We implement the "decorrelated jitter" strategy from https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/. Essentially, if consecutive retries are needed, we choose an integer: sleep = min(max, rand(interval, backoff * sleep)) This ensures that the poll is never less than interval, and nicely spreads out retries for consecutive tries. Over time, if (interval < max), the random number will be above max about (1 - 1/backoff) of the time (sleeping the max), and the rest of the time the sleep will be a random number below max, decorrelating our trigger time from other pollers.

Type declaration

Phase

Phase<T>: T | "constructed" | "disposed" | "reconnected" | "refreshed" | "rejected" | "resolved" | "standby" | "started" | "stopped"

The phase of the poll when the current tick was scheduled.

Type parameters

  • T: string

    A type for any additional tick phases a poll supports.

State

State<T, U, V>: object

Definition of poll state at any given time.

Type parameters

  • T

    The resolved type of the factory's promises.

  • U

    The rejected type of the factory's promises.

  • V: string

    The type to extend the phases supported by a poll.

Type declaration

Properties

disposed

disposed: ISignal<this, void>

A signal emitted when the poll is disposed.

frequency

frequency: Frequency

The polling frequency data.

isDisposed

isDisposed: boolean

Whether the poll is disposed.

name

name: string

The name of the poll.

state

state: State<T, U, V>

The poll state, which is the content of the currently-scheduled poll tick.

tick

tick: Promise<IPoll<T, U, V>>

A promise that resolves when the currently-scheduled tick completes.

Notes

Usually this will resolve after state.interval milliseconds from state.timestamp. It can resolve earlier if the user starts or refreshes the poll, etc.

ticked

ticked: ISignal<IPoll<T, U, V>, State<T, U, V>>

A signal emitted when the poll state changes, i.e., a new tick is scheduled.

Generated using TypeDoc