Skip to content

Implement token-bucket throttler #941

@SorraTheOrc

Description

@SorraTheOrc

Add src/github-throttler.ts implementing a token-bucket rate limiter with configurable rate (WL_GITHUB_RATE), burst (WL_GITHUB_BURST), and optional concurrency cap (WL_GITHUB_CONCURRENCY). Provide an API to schedule tasks (e.g., schedule(fn): Promise) and to wrap GitHub call helpers. Make the clock injectable to allow deterministic unit tests.\n\nAcceptance criteria:\n- src/github-throttler.ts exists and exports a usable throttler instance and types.\n- Defaults: WL_GITHUB_CONCURRENCY=6, WL_GITHUB_RATE=6, WL_GITHUB_BURST=12 applied when env not set.\n- Unit tests cover refill, burst, depletion, and concurrency cap using an injectable clock.\n

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions