feat(ha-config-bootstrap): implement xce_retry_config_t and xce_request_with_retry (tasks 10.1, 10.2)

This commit is contained in:
Rongsong Shen 2026-05-29 03:00:34 +00:00
parent bb8e531a12
commit 0ec0ffa7e3
4 changed files with 163 additions and 12 deletions

View file

@ -241,7 +241,7 @@ Dependency order: startup validation (D) unblocks vtaskmgr before election (A);
- `make test` fails
- _Requirements: 7.1, 7.2, 7.3, 7.4, 7.5, 7.6_
- [ ] 10.2 Implement xce_retry_config_t and xce_request_with_retry()
- [x] 10.2 Implement xce_retry_config_t and xce_request_with_retry()
- Add `xce_retry_config_t` to `request.h` with defaults: `max_retries=20`, `initial_retry_ms=50`, `max_retry_ms=5000`, `backoff_multiplier=2.0`
- `xce_request_with_retry(endpoint_t *ep, xce_request_t *req, const xce_retry_config_t *cfg)`: NULL cfg → use defaults; `XCE_ERR_NOT_READY` → backoff, retry; `XCE_ERR_STANDBY` with redirect → reconnect, retry; `ECONNREFUSED`/`ETIMEDOUT` → reconnect, retry; `XCE_ERR_AUTH`/`XCE_ERR_PERM`/`XCE_ERR_INVALID`/`XCE_ERR_NOENT` → surface immediately; exhausted → surface last error
- Jitter via `rand_r()` to prevent thundering herd (7.6)