Skip to content

Add an async client on httpx with timeouts and cancellable polling #27

Open

Description

@figitaki

The generated client uses synchronous requests with no timeout, and _poll_for_completion sleeps in a loop. Inside an async server such as an arcade-mcp-server tool handler, every Turnkey call blocks the event loop for the whole request plus polling.

Follow-up:

  • Generate an AsyncTurnkeyClient next to TurnkeyClient from the same codegen, on httpx.AsyncClient.
  • Add explicit connect and read timeouts to both clients, with sensible defaults.
  • Make polling honor cancellation and expose max_polling_retries and polling_interval_ms clearly; the current defaults (3 retries at 1 second) are too short for most activities.
  • Keep the sync client; let it share the request building, stamping, and result unpacking code so the two cannot drift.

Depends on #20 and #21.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions