firefly-limiter - v1.0.1
    Preparing search index...

    Interface Clock

    The two things a policy needs from time.

    Every policy reads the clock through this interface and none of them call Date.now or setTimeout directly, so a test can run a five-minute backoff schedule without waiting five minutes.

    interface Clock {
        now(): number;
        sleep(ms: number, signal?: AbortSignal): Promise<void>;
    }
    Index
    • Current time in milliseconds. Only differences between readings are used.

      Returns number

    • Resolves after ms, or rejects with the signal's reason if it aborts first.

      Parameters

      • ms: number
      • Optionalsignal: AbortSignal

      Returns Promise<void>