Skip to content

payjoin-mailroom: respect Retry-After header for 429 and 503 responses in gateway prober #1474

@codaMW

Description

@codaMW

Which crate is this feature request for?

No response

Please describe the feature you'd like to see added.

The gateway prober in payjoin-mailroom should respect the Retry-After
header from 429 and 503 HTTP responses when caching relay probe results.

Is your feature related to a problem, if so please describe it.

In payjoin-mailroom/src/ohttp_relay/gateway_prober.rs, the probe()
function has two TODO comments acknowledging this:

} else if status.is_client_error() {
    // TODO handle Retry-After for 429 too many requests
    ttls.http_4xx
} else if status.is_server_error() {
    // TODO handle Retry-After for 503 service unavailable
    ttls.http_5xx

A 429 falls back to http_4xx (1 week TTL) and 503 falls back to
http_5xx (5 seconds TTL), ignoring the server-specified duration entirely.

Describe the solution you'd like

Parse the Retry-After header value (seconds integer) from the response
and use it as the TTL when present, falling back to existing defaults
when absent. Both TODOs are in the same function and can be fixed in
one PR.

Describe any alternatives you've considered

No response

Please leave any additional context

No response

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