Skip to content

Add timeout and retry/backoff to PolarSelfClient outbound calls to api.polar.sh #13376

Description

@stilla

PolarSelfClient (server/polar/integrations/polar/client.py) calls api.polar.sh (e.g. list_recurring_products -> GET /v1/products/) with no explicit httpx.Timeout and no retry/backoff. Any httpx.RequestError (e.g. ReadError, connection reset mid-read) is wrapped as PolarNetworkError -> PolarSelfClientOperationalError, which callers like organization.endpoints.list_plans do not catch, so it surfaces as a bare 500.

This isn't a one-off: Logfire shows the same ReadError -> PolarNetworkError chain hitting api.polar.sh at a baseline of 1-2/hr across both the api and worker services (also hit worker's get_order webhook processing the same day), plus a larger spike of 111 errors in one hour on 2026-07-20. Reference: Sentry SERVER-4WB.

Suggested fix

Related

Sent by @maximevast from Stilla investigation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions