@mark1russell7/machines 0.3.18 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,6 +34,7 @@ The algebra reads these documents. It gives the closed form of each timer, the f
34
34
  | `NODE_HTTP_SERVER` | `node-http-server` | One connection of the `http.Server` of Node 24.21.0 | server | 8 implemented |
35
35
  | `NODE_HTTP_AGENT` | `node-http-agent` | One socket of the `http.Agent` of Node 24.21.0 | driver | 9 implemented |
36
36
  | `UNDICI_CLIENT` | `undici-client-h1` | The socket of an HTTP/1.1 `Client` of undici 8.12.2 | driver | 8 implemented |
37
+ | `UNDICI_RETRY` | `undici-retry-agent` | One request through a `RetryAgent` of undici 8.12.2 | driver | 7 implemented, 1 normative |
37
38
  | `GO_TRANSPORT` | `go-nethttp-transport` | One connection of the `http.Transport` of Go 1.27.2 | driver | 7 implemented |
38
39
  | `PROCEDURES_WS_CLIENT` | `procedures-ws-client` | The WebSocket client of `@procedures/client` 0.3.0 | driver | 9 implemented, 1 documented |
39
40
  | `PROCEDURES_WS_SERVER` | `procedures-ws-server` | The WebSocket server of `@procedures/client` 0.3.0 | server | 4 implemented |
@@ -60,7 +61,7 @@ The algebra reads these documents. It gives the closed form of each timer, the f
60
61
  | `DOCKER_PROXY_LINK` | `docker-proxy-link` | docker-proxy of Docker Engine 29.1.5: one proxied TCP connection and its close | proxy | 9 implemented |
61
62
  | `CADDY_HTTP2` | `caddy-http2` | Caddy 2.11.7 as an HTTP/2 proxy of gRPC: one connection of a client, its idle close, its replies and its stop | proxy | 12 implemented |
62
63
 
63
- Twenty-eight documents operate on Linux TCP (`over`). Linux TCP, conntrack, the Sentinel, the replication of mongod, aten and the member of Ra operate on no other document. The `conditions` of each document give the range where it holds, for example a range of kernels.
64
+ Twenty-eight documents operate on Linux TCP (`over`). Seven documents operate on no other document: Linux TCP, conntrack, the Sentinel, the replication of mongod, aten, the member of Ra and the `RetryAgent` of undici. The `RetryAgent` is one request above the sockets of a `Client`. Its timer is the delay of a retry. Each retry can go on a new socket. The `conditions` of each document give the range where it holds, for example a range of kernels.
64
65
 
65
66
  The package also gives these parts:
66
67
 
package/build/index.d.ts CHANGED
@@ -95,6 +95,29 @@ export declare const NODE_HTTP_SERVER: Machine;
95
95
  */
96
96
  export declare const UNDICI_CLIENT: Machine;
97
97
  //#endregion
98
+ //#region src/http/undici-retry.d.ts
99
+ /**
100
+ * This document is one request through a `RetryAgent` of undici 8.12.2: the retries of a reply
101
+ * whose status is retryable, for example 429 or 503. Each fact comes from the published package at
102
+ * 8.12.2, with the file and the line. The defaults are 5 retries, a backoff from 500 ms with a factor
103
+ * of 2, a cap of 30 s, and Retry-After read.
104
+ *
105
+ * - The delay of a retry is the Retry-After of the reply, capped by `maxTimeout`. A Retry-After
106
+ * longer than the cap does not stop the retries: the retry comes early. A reply without
107
+ * Retry-After gets the backoff, with no jitter.
108
+ * - The agent gives up after `maxRetries` retries. The caller then gets `RequestRetryError`, with
109
+ * the status of the last reply. Thus the retry window of the caller is the sum of the delays.
110
+ * - A POST and a PATCH are not retried.
111
+ * - The delay is a native Node timer. It arms after the parse of the whole reply, thus it comes after
112
+ * the last segment by the handling time of the program. No source bounds that time, and this
113
+ * document does not hold it. The cells add it from a calibration (`HANDLING` in
114
+ * `packages/cells/src/http/race.ts`).
115
+ *
116
+ * The plain `Client` and `fetch` of undici, and the `fetch` of Node 24.21.0 (undici 7.29.1), send no
117
+ * request again for a status. Their retry window is 0.
118
+ */
119
+ export declare const UNDICI_RETRY: Machine;
120
+ //#endregion
98
121
  //#region src/ioredis-sentinel.d.ts
99
122
  /**
100
123
  * This document is the Sentinel path of ioredis 6.0.0. It tells how ioredis finds the primary of a
package/build/index.js CHANGED
@@ -1,49 +1,49 @@
1
1
  import { machineSchema } from "@mark1russell7/algebra";
2
2
  import { z } from "zod";
3
3
  //#region src/grpc/grpc-go-server.ts
4
- const AT$11 = "grpc-go v1.84.0";
4
+ const AT$12 = "grpc-go v1.84.0";
5
5
  const GO = "go1.27.2 src/net";
6
6
  const ETCD = "etcd v3.6.15";
7
7
  /** These are the facts of the transport of grpc-go, for each server on it. */
8
8
  const TRANSPORT = [
9
9
  {
10
- ref: `${AT$11} internal/transport/defaults.go:31-40 the server keepalive: Time 2 h, Timeout 20 s. MinTime of the policy 5 min. MaxConnectionIdle, Age and AgeGrace infinite`,
10
+ ref: `${AT$12} internal/transport/defaults.go:31-40 the server keepalive: Time 2 h, Timeout 20 s. MinTime of the policy 5 min. MaxConnectionIdle, Age and AgeGrace infinite`,
11
11
  rung: "implemented"
12
12
  },
13
13
  {
14
- ref: `${AT$11} internal/transport/http2_server.go:226-253 the defaults of the parameters, a jitter of 10 % on MaxConnectionAge, and TCP_USER_TIMEOUT = Timeout when Time is not infinite`,
14
+ ref: `${AT$12} internal/transport/http2_server.go:226-253 the defaults of the parameters, a jitter of 10 % on MaxConnectionAge, and TCP_USER_TIMEOUT = Timeout when Time is not infinite`,
15
15
  rung: "implemented"
16
16
  },
17
17
  {
18
- ref: `${AT$11} internal/syscall/syscall_linux.go:71-90 SetTCPUserTimeout acts only on a *net.TCPConn. On any other net.Conn it does nothing`,
18
+ ref: `${AT$12} internal/syscall/syscall_linux.go:71-90 SetTCPUserTimeout acts only on a *net.TCPConn. On any other net.Conn it does nothing`,
19
19
  rung: "implemented"
20
20
  },
21
21
  {
22
- ref: `${AT$11} internal/transport/http2_server.go:1197-1286 keepalive(): a PING after Time with no read, and Close when no read comes for Timeout after it. MaxConnectionIdle and MaxConnectionAge drain with GOAWAY, and AgeGrace closes`,
22
+ ref: `${AT$12} internal/transport/http2_server.go:1197-1286 keepalive(): a PING after Time with no read, and Close when no read comes for Timeout after it. MaxConnectionIdle and MaxConnectionAge drain with GOAWAY, and AgeGrace closes`,
23
23
  rung: "implemented"
24
24
  },
25
25
  {
26
- ref: `${AT$11} internal/transport/http2_server.go:881-933 handlePing: a PING less than MinTime after the last one is a strike, and with no stream open and PermitWithoutStream false, less than 2 h. The third strike sends GOAWAY ENHANCE_YOUR_CALM too_many_pings and closes the connection`,
26
+ ref: `${AT$12} internal/transport/http2_server.go:881-933 handlePing: a PING less than MinTime after the last one is a strike, and with no stream open and PermitWithoutStream false, less than 2 h. The third strike sends GOAWAY ENHANCE_YOUR_CALM too_many_pings and closes the connection`,
27
27
  rung: "implemented"
28
28
  },
29
29
  {
30
- ref: `${AT$11} internal/transport/http2_server.go:279-281, :1064, :1132, :1176 each write of headers, a status or data by the server clears the strikes`,
30
+ ref: `${AT$12} internal/transport/http2_server.go:279-281, :1064, :1132, :1176 each write of headers, a status or data by the server clears the strikes`,
31
31
  rung: "implemented"
32
32
  },
33
33
  {
34
- ref: `${AT$11} internal/transport/http2_server.go:1291-1310 Close closes the net.Conn: a FIN, or a reset when bytes are unread`,
34
+ ref: `${AT$12} internal/transport/http2_server.go:1291-1310 Close closes the net.Conn: a FIN, or a reset when bytes are unread`,
35
35
  rung: "implemented"
36
36
  },
37
37
  {
38
- ref: `${AT$11} internal/transport/http2_server.go:536-537, :603-615 a call with the header grpc-timeout gets a timer of that timeout from the read of its headers. Its end closes the stream with RST_STREAM CANCEL, and the context of the handler ends`,
38
+ ref: `${AT$12} internal/transport/http2_server.go:536-537, :603-615 a call with the header grpc-timeout gets a timer of that timeout from the read of its headers. Its end closes the stream with RST_STREAM CANCEL, and the context of the handler ends`,
39
39
  rung: "implemented"
40
40
  },
41
41
  {
42
- ref: `${AT$11} server.go:192, :1000-1009 a deadline of 120 s for the handshake of each new connection (ConnectionTimeout)`,
42
+ ref: `${AT$12} server.go:192, :1000-1009 a deadline of 120 s for the handshake of each new connection (ConnectionTimeout)`,
43
43
  rung: "implemented"
44
44
  },
45
45
  {
46
- ref: `${AT$11} server.go:894-905 the comment of grpc-go: Go sets a TCP keepalive of 15 s on each accepted connection`,
46
+ ref: `${AT$12} server.go:894-905 the comment of grpc-go: Go sets a TCP keepalive of 15 s on each accepted connection`,
47
47
  rung: "documented"
48
48
  },
49
49
  {
@@ -702,7 +702,7 @@ const ETCD_SERVER = serverOf({
702
702
  });
703
703
  //#endregion
704
704
  //#region src/grpc/grpc-js.ts
705
- const AT$10 = "@grpc/grpc-js 1.14.6 src";
705
+ const AT$11 = "@grpc/grpc-js 1.14.6 src";
706
706
  /**
707
707
  * This document is grpc-js 1.14.6 on Node, for one channel to one server with no TLS, its transport
708
708
  * (one HTTP/2 session on one TCP connection) and one unary call on it. It gives the states of the
@@ -732,83 +732,83 @@ const GRPC_JS = machineSchema.parse({
732
732
  },
733
733
  sources: [
734
734
  {
735
- ref: `${AT$10}/transport.ts:70 KEEPALIVE_TIMEOUT_MS is 20000`,
735
+ ref: `${AT$11}/transport.ts:70 KEEPALIVE_TIMEOUT_MS is 20000`,
736
736
  rung: "implemented"
737
737
  },
738
738
  {
739
- ref: `${AT$10}/transport.ts:183-198 grpc.keepalive_time_ms is -1 when the caller gives none, grpc.keepalive_timeout_ms is 20000, and grpc.keepalive_permit_without_calls is false`,
739
+ ref: `${AT$11}/transport.ts:183-198 grpc.keepalive_time_ms is -1 when the caller gives none, grpc.keepalive_timeout_ms is 20000, and grpc.keepalive_permit_without_calls is false`,
740
740
  rung: "implemented"
741
741
  },
742
742
  {
743
- ref: `${AT$10}/transport.ts:447-453 a PING goes out only with a keepalive time above 0, and with a call in flight or permit_without_calls`,
743
+ ref: `${AT$11}/transport.ts:447-453 a PING goes out only with a keepalive time above 0, and with a call in flight or permit_without_calls`,
744
744
  rung: "implemented"
745
745
  },
746
746
  {
747
- ref: `${AT$10}/transport.ts:455-507 each PING starts a timer of keepalive_timeout_ms, and its end with no ACK ends the transport (handleDisconnect). A failed send of the PING ends it too`,
747
+ ref: `${AT$11}/transport.ts:455-507 each PING starts a timer of keepalive_timeout_ms, and its end with no ACK ends the transport (handleDisconnect). A failed send of the PING ends it too`,
748
748
  rung: "implemented"
749
749
  },
750
750
  {
751
- ref: `${AT$10}/transport.ts:515-534 and :553-561 the keepalive timer starts with the first call in flight, and after each ACK. It is not reset by data. When it ends with no call in flight, the PING goes out at the start of the next call`,
751
+ ref: `${AT$11}/transport.ts:515-534 and :553-561 the keepalive timer starts with the first call in flight, and after each ACK. It is not reset by data. When it ends with no call in flight, the PING goes out at the start of the next call`,
752
752
  rung: "implemented"
753
753
  },
754
754
  {
755
- ref: `${AT$10}/transport.ts:200-242 a close or an error of the session, or a close of its socket, ends the transport. A GOAWAY makes it unusable (reportDisconnectToOwner)`,
755
+ ref: `${AT$11}/transport.ts:200-242 a close or an error of the session, or a close of its socket, ends the transport. A GOAWAY makes it unusable (reportDisconnectToOwner)`,
756
756
  rung: "implemented"
757
757
  },
758
758
  {
759
- ref: `${AT$10}/transport.ts:205-227 a GOAWAY ENHANCE_YOUR_CALM with the data too_many_pings tells the subchannel that the server refused the pings`,
759
+ ref: `${AT$11}/transport.ts:205-227 a GOAWAY ENHANCE_YOUR_CALM with the data too_many_pings tells the subchannel that the server refused the pings`,
760
760
  rung: "implemented"
761
761
  },
762
762
  {
763
- ref: `${AT$10}/transport.ts:431-441 handleDisconnect: each call in flight gets onDisconnect, and the session is destroyed in the next turn of the event loop`,
763
+ ref: `${AT$11}/transport.ts:431-441 handleDisconnect: each call in flight gets onDisconnect, and the session is destroyed in the next turn of the event loop`,
764
764
  rung: "implemented"
765
765
  },
766
766
  {
767
- ref: `${AT$10}/transport.ts:684-687 shutdown closes the session: a GOAWAY, then the end of the socket after the last stream`,
767
+ ref: `${AT$11}/transport.ts:684-687 shutdown closes the session: a GOAWAY, then the end of the socket after the last stream`,
768
768
  rung: "implemented"
769
769
  },
770
770
  {
771
- ref: `${AT$10}/transport.ts:792-810 the transport is ready at the first SETTINGS of the server (remoteSettings)`,
771
+ ref: `${AT$11}/transport.ts:792-810 the transport is ready at the first SETTINGS of the server (remoteSettings)`,
772
772
  rung: "implemented"
773
773
  },
774
774
  {
775
- ref: `${AT$10}/transport.ts:818-840 the TCP connect is net.connect with no timeout`,
775
+ ref: `${AT$11}/transport.ts:818-840 the TCP connect is net.connect with no timeout`,
776
776
  rung: "implemented"
777
777
  },
778
778
  {
779
- ref: `${AT$10}/transport.ts:862 setNoDelay on each connection: TCP_NODELAY, thus no Nagle. No setKeepAlive anywhere in the package`,
779
+ ref: `${AT$11}/transport.ts:862 setNoDelay on each connection: TCP_NODELAY, thus no Nagle. No setKeepAlive anywhere in the package`,
780
780
  rung: "implemented"
781
781
  },
782
782
  {
783
- ref: `${AT$10}/subchannel-call.ts:360-371 onDisconnect ends the call with UNAVAILABLE 'Connection dropped' in the next turn of the event loop, unless the stream ends first`,
783
+ ref: `${AT$11}/subchannel-call.ts:360-371 onDisconnect ends the call with UNAVAILABLE 'Connection dropped' in the next turn of the event loop, unless the stream ends first`,
784
784
  rung: "implemented"
785
785
  },
786
786
  {
787
- ref: `${AT$10}/subchannel-call.ts:230-329 the end of a stream with no status: REFUSED_STREAM is UNAVAILABLE, CANCEL after a dropped connection is UNAVAILABLE, and an internal error of ECONNRESET or ETIMEDOUT is UNAVAILABLE`,
787
+ ref: `${AT$11}/subchannel-call.ts:230-329 the end of a stream with no status: REFUSED_STREAM is UNAVAILABLE, CANCEL after a dropped connection is UNAVAILABLE, and an internal error of ECONNRESET or ETIMEDOUT is UNAVAILABLE`,
788
788
  rung: "implemented"
789
789
  },
790
790
  {
791
- ref: `${AT$10}/load-balancing-call.ts:257-261 a stream that the server refused has the progress REFUSED, and any other started stream PROCESSED`,
791
+ ref: `${AT$11}/load-balancing-call.ts:257-261 a stream that the server refused has the progress REFUSED, and any other started stream PROCESSED`,
792
792
  rung: "implemented"
793
793
  },
794
794
  {
795
- ref: `${AT$10}/retrying-call.ts:631-652 a transparent retry for NOT_STARTED, and one for REFUSED. A PROCESSED call is retried only by a retry policy of the service config, which the defaults do not have`,
795
+ ref: `${AT$11}/retrying-call.ts:631-652 a transparent retry for NOT_STARTED, and one for REFUSED. A PROCESSED call is retried only by a retry policy of the service config, which the defaults do not have`,
796
796
  rung: "implemented"
797
797
  },
798
798
  {
799
- ref: `${AT$10}/load-balancing-call.ts:338-345 a pick in TRANSIENT_FAILURE fails the call at once, unless it asks for waitForReady`,
799
+ ref: `${AT$11}/load-balancing-call.ts:338-345 a pick in TRANSIENT_FAILURE fails the call at once, unless it asks for waitForReady`,
800
800
  rung: "implemented"
801
801
  },
802
802
  {
803
- ref: `${AT$10}/resolving-call.ts:118-180 the deadline of a call is a timer from the start of the call. Its end cancels the call with DEADLINE_EXCEEDED`,
803
+ ref: `${AT$11}/resolving-call.ts:118-180 the deadline of a call is a timer from the start of the call. Its end cancels the call with DEADLINE_EXCEEDED`,
804
804
  rung: "implemented"
805
805
  },
806
806
  {
807
- ref: `${AT$10}/deadline.ts:39-52 the header grpc-timeout is the time left to the deadline when the call sends its headers, rounded up to whole milliseconds. A server can start a timer of it`,
807
+ ref: `${AT$11}/deadline.ts:39-52 the header grpc-timeout is the time left to the deadline when the call sends its headers, rounded up to whole milliseconds. A server can start a timer of it`,
808
808
  rung: "implemented"
809
809
  },
810
810
  {
811
- ref: `${AT$10}/subchannel-call.ts:269-279 a RST_STREAM CANCEL of the server ends the call with CANCELLED 'Call cancelled'`,
811
+ ref: `${AT$11}/subchannel-call.ts:269-279 a RST_STREAM CANCEL of the server ends the call with CANCELLED 'Call cancelled'`,
812
812
  rung: "implemented"
813
813
  },
814
814
  {
@@ -816,19 +816,19 @@ const GRPC_JS = machineSchema.parse({
816
816
  rung: "observed"
817
817
  },
818
818
  {
819
- ref: `${AT$10}/subchannel.ts:275-291 the end of the transport takes the subchannel from READY to IDLE. After too_many_pings the keepalive time doubles`,
819
+ ref: `${AT$11}/subchannel.ts:275-291 the end of the transport takes the subchannel from READY to IDLE. After too_many_pings the keepalive time doubles`,
820
820
  rung: "implemented"
821
821
  },
822
822
  {
823
- ref: `${AT$10}/subchannel.ts:298-304 a failed connect takes the subchannel to TRANSIENT_FAILURE`,
823
+ ref: `${AT$11}/subchannel.ts:298-304 a failed connect takes the subchannel to TRANSIENT_FAILURE`,
824
824
  rung: "implemented"
825
825
  },
826
826
  {
827
- ref: `${AT$10}/backoff-timeout.ts:23-26 the reconnect waits 1000 ms first, each next wait 1.6 times longer, up to 120000 ms, with a jitter of 0.2`,
827
+ ref: `${AT$11}/backoff-timeout.ts:23-26 the reconnect waits 1000 ms first, each next wait 1.6 times longer, up to 120000 ms, with a jitter of 0.2`,
828
828
  rung: "implemented"
829
829
  },
830
830
  {
831
- ref: `${AT$10}/internal-channel.ts:74-77 and :324-325 a channel with no call for grpc.client_idle_timeout_ms goes IDLE: 30 min at the defaults, 1 s at least`,
831
+ ref: `${AT$11}/internal-channel.ts:74-77 and :324-325 a channel with no call for grpc.client_idle_timeout_ms goes IDLE: 30 min at the defaults, 1 s at least`,
832
832
  rung: "implemented"
833
833
  },
834
834
  {
@@ -2581,6 +2581,222 @@ const UNDICI_CLIENT = machineSchema.parse({
2581
2581
  }
2582
2582
  });
2583
2583
  //#endregion
2584
+ //#region src/http/undici-retry.ts
2585
+ const AT$10 = "undici 8.12.2 lib/handler/retry-handler.js";
2586
+ /**
2587
+ * This document is one request through a `RetryAgent` of undici 8.12.2: the retries of a reply
2588
+ * whose status is retryable, for example 429 or 503. Each fact comes from the published package at
2589
+ * 8.12.2, with the file and the line. The defaults are 5 retries, a backoff from 500 ms with a factor
2590
+ * of 2, a cap of 30 s, and Retry-After read.
2591
+ *
2592
+ * - The delay of a retry is the Retry-After of the reply, capped by `maxTimeout`. A Retry-After
2593
+ * longer than the cap does not stop the retries: the retry comes early. A reply without
2594
+ * Retry-After gets the backoff, with no jitter.
2595
+ * - The agent gives up after `maxRetries` retries. The caller then gets `RequestRetryError`, with
2596
+ * the status of the last reply. Thus the retry window of the caller is the sum of the delays.
2597
+ * - A POST and a PATCH are not retried.
2598
+ * - The delay is a native Node timer. It arms after the parse of the whole reply, thus it comes after
2599
+ * the last segment by the handling time of the program. No source bounds that time, and this
2600
+ * document does not hold it. The cells add it from a calibration (`HANDLING` in
2601
+ * `packages/cells/src/http/race.ts`).
2602
+ *
2603
+ * The plain `Client` and `fetch` of undici, and the `fetch` of Node 24.21.0 (undici 7.29.1), send no
2604
+ * request again for a status. Their retry window is 0.
2605
+ */
2606
+ const UNDICI_RETRY = machineSchema.parse({
2607
+ format: "mark1russell7.machine/1",
2608
+ id: "undici-retry-agent",
2609
+ title: "One request through a RetryAgent of undici 8.12.2",
2610
+ layer: "driver",
2611
+ version: "8.12.2",
2612
+ conditions: {
2613
+ undici: "8.12.2",
2614
+ node: "24.21.0",
2615
+ throwOnError: "true"
2616
+ },
2617
+ sources: [
2618
+ {
2619
+ ref: `${AT$10}:125-133 the defaults: retryAfter true, maxTimeout 30000, minTimeout 500, timeoutFactor 2, maxRetries 5, the methods GET HEAD OPTIONS PUT DELETE TRACE QUERY, the statusCodes 500 502 503 504 429`,
2620
+ rung: "implemented"
2621
+ },
2622
+ {
2623
+ ref: "undici 8.12.2 lib/dispatcher/retry-agent.js:18-27: a RetryAgent wraps a dispatcher with a RetryHandler",
2624
+ rung: "implemented"
2625
+ },
2626
+ {
2627
+ ref: `${AT$10}:331-351 the policy: a method or a status out of its lists is not retried, and a counter above maxRetries gives up`,
2628
+ rung: "implemented"
2629
+ },
2630
+ {
2631
+ ref: `${AT$10}:353-370 the delay: Retry-After in seconds times 1000, or an HTTP-date less the clock of the client (:13-16), capped by maxTimeout; 0 at once; else min(minTimeout * timeoutFactor^(counter - 1), maxTimeout); then setTimeout`,
2632
+ rung: "implemented"
2633
+ },
2634
+ {
2635
+ ref: `${AT$10}:380 the counter: one more at each reply`,
2636
+ rung: "implemented"
2637
+ },
2638
+ {
2639
+ ref: `${AT$10}:175-192 and :518-535 a retryable status with throwOnError drops the body of the reply, and the error goes to the policy`,
2640
+ rung: "implemented"
2641
+ },
2642
+ {
2643
+ ref: "undici 8.12.2 lib/core/errors.js:362-371 RequestRetryError: code UND_ERR_REQ_RETRY, statusCode, headers, data.count",
2644
+ rung: "implemented"
2645
+ },
2646
+ {
2647
+ ref: "RFC 9110 §10.2.3: Retry-After, as delay-seconds or an HTTP-date",
2648
+ rung: "normative"
2649
+ }
2650
+ ],
2651
+ states: {
2652
+ IDLE: {
2653
+ initial: true,
2654
+ pseudo: true
2655
+ },
2656
+ SENT: { note: "a send of the request waits for its reply" },
2657
+ WAITING: { note: "the delay of a retry: the Retry-After of the reply, or the backoff" },
2658
+ DONE: {
2659
+ final: true,
2660
+ note: "a reply whose status is not retryable goes to the caller"
2661
+ },
2662
+ FAILED: {
2663
+ final: true,
2664
+ note: "RequestRetryError (UND_ERR_REQ_RETRY), with the status of the last reply"
2665
+ }
2666
+ },
2667
+ events: {
2668
+ "req.dispatch": { kind: "app" },
2669
+ "rx.retryable": {
2670
+ kind: "rx",
2671
+ note: "a reply with a status of statusCodes, for example 429 with Retry-After"
2672
+ },
2673
+ "rx.final": {
2674
+ kind: "rx",
2675
+ note: "a reply with another status, for example 200"
2676
+ },
2677
+ "timer.retry": { kind: "timer" }
2678
+ },
2679
+ knobs: {
2680
+ maxRetries: {
2681
+ key: "undici RetryAgent maxRetries",
2682
+ scope: "client",
2683
+ unit: "count",
2684
+ default: 5
2685
+ },
2686
+ minTimeout: {
2687
+ key: "undici RetryAgent minTimeout",
2688
+ scope: "client",
2689
+ unit: "ms",
2690
+ default: 500
2691
+ },
2692
+ maxTimeout: {
2693
+ key: "undici RetryAgent maxTimeout",
2694
+ scope: "client",
2695
+ unit: "ms",
2696
+ default: 3e4
2697
+ },
2698
+ timeoutFactor: {
2699
+ key: "undici RetryAgent timeoutFactor",
2700
+ scope: "client",
2701
+ unit: "count",
2702
+ default: 2
2703
+ },
2704
+ retry_after: {
2705
+ key: "Retry-After of the reply, in seconds",
2706
+ scope: "reply",
2707
+ unit: "s",
2708
+ default: null,
2709
+ note: "the server gives it. An HTTP-date counts on the clock of the client"
2710
+ },
2711
+ hz: {
2712
+ key: "CONFIG_HZ",
2713
+ scope: "global",
2714
+ unit: "Hz",
2715
+ default: null,
2716
+ note: "the HZ of the kernel, for the step of the coarse loop clock of libuv (timers.ts)"
2717
+ }
2718
+ },
2719
+ timers: {
2720
+ retry_after: {
2721
+ duration: {
2722
+ expr: "min(retry_after * 1000, maxTimeout)",
2723
+ unit: "ms"
2724
+ },
2725
+ lateness: nodeTimerLateness("min(retry_after * 1000, maxTimeout)"),
2726
+ early: NODE_TIMER_EARLY,
2727
+ arms: ["enter:WAITING"],
2728
+ cancels: ["req.dispatch"],
2729
+ fires: "timer.retry",
2730
+ note: "setTimeout(cb, retryTimeout) with the Retry-After of the reply. It arms after the parse of the whole reply"
2731
+ },
2732
+ backoff: {
2733
+ duration: {
2734
+ expr: "min(minTimeout * pow(timeoutFactor, fired), maxTimeout)",
2735
+ unit: "ms"
2736
+ },
2737
+ lateness: nodeTimerLateness("min(minTimeout * pow(timeoutFactor, fired), maxTimeout)"),
2738
+ early: NODE_TIMER_EARLY,
2739
+ arms: ["enter:WAITING"],
2740
+ cancels: ["req.dispatch"],
2741
+ fires: "timer.retry",
2742
+ backoff: { resets: ["req.dispatch"] },
2743
+ note: "a reply without Retry-After: 0.5, 1, 2, 4 and 8 s at the defaults, with no jitter"
2744
+ }
2745
+ },
2746
+ transitions: [
2747
+ {
2748
+ id: "ur.send",
2749
+ from: "IDLE",
2750
+ to: "SENT",
2751
+ on: "req.dispatch"
2752
+ },
2753
+ {
2754
+ id: "ur.wait",
2755
+ from: "SENT",
2756
+ to: "WAITING",
2757
+ on: "rx.retryable",
2758
+ guard: "the count of replies is maxRetries or less, the method is in its list, and no part of the body went to the caller",
2759
+ source: "retry-handler.js:331-351, :380, :581-584"
2760
+ },
2761
+ {
2762
+ id: "ur.give-up",
2763
+ from: "SENT",
2764
+ to: "FAILED",
2765
+ on: "rx.retryable",
2766
+ guard: "the count of replies is above maxRetries, or the method is not in its list (POST, PATCH)",
2767
+ errno: "UND_ERR_REQ_RETRY",
2768
+ source: "retry-handler.js:331-335, :347-350, :430-436"
2769
+ },
2770
+ {
2771
+ id: "ur.retry-after",
2772
+ from: "WAITING",
2773
+ to: "SENT",
2774
+ on: "timer.retry",
2775
+ timer: "retry_after",
2776
+ guard: "the reply had a Retry-After of 0 or more",
2777
+ emits: ["tx.request"],
2778
+ source: "retry-handler.js:353-365, :370"
2779
+ },
2780
+ {
2781
+ id: "ur.backoff",
2782
+ from: "WAITING",
2783
+ to: "SENT",
2784
+ on: "timer.retry",
2785
+ timer: "backoff",
2786
+ guard: "the reply had no Retry-After, or one in the past, or one that does not parse",
2787
+ emits: ["tx.request"],
2788
+ source: "retry-handler.js:361-370"
2789
+ },
2790
+ {
2791
+ id: "ur.done",
2792
+ from: "SENT",
2793
+ to: "DONE",
2794
+ on: "rx.final",
2795
+ source: "retry-handler.js:373-383"
2796
+ }
2797
+ ]
2798
+ });
2799
+ //#endregion
2584
2800
  //#region src/ioredis-sentinel.ts
2585
2801
  const AT$9 = "ioredis 6.0.0 built";
2586
2802
  /**
@@ -15492,6 +15708,7 @@ const MACHINES = byId([
15492
15708
  NODE_HTTP_SERVER,
15493
15709
  NODE_HTTP_AGENT,
15494
15710
  UNDICI_CLIENT,
15711
+ UNDICI_RETRY,
15495
15712
  GO_TRANSPORT,
15496
15713
  PROCEDURES_WS_CLIENT,
15497
15714
  PROCEDURES_WS_SERVER,
@@ -15519,6 +15736,6 @@ const MACHINES = byId([
15519
15736
  CADDY_HTTP2
15520
15737
  ]);
15521
15738
  //#endregion
15522
- export { AMQPLIB, ATEN_DETECTOR, CADDY_HTTP2, DOCKER_PROXY_LINK, ENVOY_HTTP2, ETCD_SERVER, GO_TRANSPORT, GRPC_GO_SERVER, GRPC_JS, HIKARICP_PGJDBC, IOREDIS_SENTINEL, IOREDIS_STATUS, LINUX_TCP, MACHINES, MANIFESTATIONS, MONGODB_NODE, MONGOD_REPL, MONGOD_SESSION, NF_CONNTRACK_TCP, NODE_HTTP_AGENT, NODE_HTTP_SERVER, NODE_POSTGRES, NODE_TIMER_EARLY, PGBOUNCER_CLIENT, PGBOUNCER_SERVER, PGPOOL_SESSION, POSTGRES_SESSION, PROCEDURES_WS_CLIENT, PROCEDURES_WS_SERVER, RABBITMQ_CONNECTION, RA_MEMBER, REDIS_CLIENT, SENTINEL, SUPAVISOR_CLIENT, SUPAVISOR_SERVER, TOXIPROXY_LINK, UNDICI_CLIENT, UNDICI_TICK_MS, goLateSeconds, goTimerLateness, nodeEarlySeconds, nodeLateSeconds, nodeTimerLateness, undiciFastEarly, undiciFastLateness };
15739
+ export { AMQPLIB, ATEN_DETECTOR, CADDY_HTTP2, DOCKER_PROXY_LINK, ENVOY_HTTP2, ETCD_SERVER, GO_TRANSPORT, GRPC_GO_SERVER, GRPC_JS, HIKARICP_PGJDBC, IOREDIS_SENTINEL, IOREDIS_STATUS, LINUX_TCP, MACHINES, MANIFESTATIONS, MONGODB_NODE, MONGOD_REPL, MONGOD_SESSION, NF_CONNTRACK_TCP, NODE_HTTP_AGENT, NODE_HTTP_SERVER, NODE_POSTGRES, NODE_TIMER_EARLY, PGBOUNCER_CLIENT, PGBOUNCER_SERVER, PGPOOL_SESSION, POSTGRES_SESSION, PROCEDURES_WS_CLIENT, PROCEDURES_WS_SERVER, RABBITMQ_CONNECTION, RA_MEMBER, REDIS_CLIENT, SENTINEL, SUPAVISOR_CLIENT, SUPAVISOR_SERVER, TOXIPROXY_LINK, UNDICI_CLIENT, UNDICI_RETRY, UNDICI_TICK_MS, goLateSeconds, goTimerLateness, nodeEarlySeconds, nodeLateSeconds, nodeTimerLateness, undiciFastEarly, undiciFastLateness };
15523
15740
 
15524
15741
  //# sourceMappingURL=index.js.map