1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! Polymarket's hooks for core's send loop: its retry policy, its rate limit
//! tables, and the CLOB's composed throttle.
//!
//! Every Polymarket client shares them on
//! [`HttpClient::send`](crate::HttpClient::send): gamma, data, perps, clob and
//! relay. The module moves to `polyoxide-polymarket` in S2.
use Duration;
use StatusCode;
use crate;
use crateRetryConfig;
pub use ;
pub use ;
/// Polymarket's one retry policy: core's [`DefaultRetryPolicy`], plus
/// `425 Too Early`.
///
/// Retries two statuses, both of which upstream documents as "retry with
/// exponential backoff":
///
/// - `429 Too Many Requests` — rate limited. As in [`DefaultRetryPolicy`], it
/// holds every request on the throttle for the schedule's first delay, even
/// when no retry is left.
/// - `425 Too Early` — Polymarket's matching engine is restarting. It returns
/// this with no body, so nothing was processed. It is retried after the
/// loop's floor and holds nothing: only the request that saw it waits.
///
/// With no retry left (`retries_left == 0`), either status is a
/// [`Outcome::Fail`], and a `429` keeps its hold.
///
/// Deliberately narrow: 5xx and 408 are *not* retried. A 5xx is retriable in
/// the [`Classify`](polyoxide_venue::Classify) sense, but it can mean the
/// request was partially applied, and the loop resends non-idempotent
/// writes. 503 in particular is what post-only mode answers, with a
/// `Retry-After` of about 79 s: far too long to block inside a request, and it
/// rejects orders wholesale. The two statuses above are safe because neither
/// reaches the matching engine — and for order placement the resent body is
/// byte-identical, so the order hash is unchanged and the venue rejects a
/// genuine double-submit as a duplicate. Callers wanting broader retry
/// semantics should drive them from the error's class with their own
/// idempotency judgement. Narrowing this set needs a DRIFT row (AD-17).
;