cvictory opened a new pull request, #3319:
URL: https://github.com/apache/dubbo-go/pull/3319
## What changed
### New files
- `protocol/triple/retry_transport.go` — `retryTransport` decorator that
wraps any `http.RoundTripper` and transparently retries on connection-level
errors; `isRetriableError` / `canRetry` helpers
- `protocol/triple/retry_transport_test.go` — unit tests covering EOF retry,
stream-body guard, max-retries exhaustion, non-retriable errors, and helper
functions
### Modified files
- `common/constant/default.go` — add `DefaultConnectTimeout = "3s"` and
`DefaultMaxRetries = 2`
- `common/constant/key.go` — add `ConnectTimeout` and `MaxRetries` URL
parameter keys
- `global/triple_config.go` — extend `TripleConfig` with `ConnectTimeout`
and `MaxRetries` fields; update `Clone()`
- `protocol/triple/client.go` — `genKeepAliveOptions` now parses connect
timeout and max retries; `CallHTTP2` branch injects `net.Dialer{Timeout}` into
dial phase and wraps transport with `retryTransport`
- `protocol/triple/dual_transport.go` — `newDualTransport` accepts
`connectTimeout` parameter and injects it into the HTTP/2 branch
`DialTLSContext`
- `protocol/triple/client_test.go` — update callers of changed signatures;
add AC-1/5/6 test cases
## Design decisions
- **Connect timeout** is applied at the TCP dial phase
(`net.Dialer.Timeout`), not at the request level (already covered by
`TimeoutKey`).
- **Retry guard** uses `req.Body == nil || req.GetBody != nil` — Triple uses
`io.Pipe` bodies that cannot be replayed, so only body-less or factory-backed
requests are retried.
- **retryTransport** is a pure decorator; zero changes to `http2.Transport`
internals.
- `MaxRetries = 0` disables retries entirely (returns inner transport
unchanged).
## Verification
- Tests: all new tests pass (`TestRetryTransport_*`, `TestIsRetriableError`,
`TestCanRetry`, `TestGenKeepAliveOptions_*`,
`Test_newClientManager_WithConnectTimeout`)
- Existing `./protocol/triple/...` tests: pass (pre-existing
`TestServer/http1/grpc/.../cumsum_cancel_before_send` flake confirmed on `main`
before this change)
- Build: `go build ./common/constant/... ./global/... ./protocol/triple/...`
passes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]