Files
ngit-grasp/src
DanConwayDev 09bb4e1d7a Merge #1a76cd3d: Fix relay retry churn and avoidable response stalls
nostr:nevent1qgsx2lyl2e4zvfadwcvkd9fkrcwczj7mf858hy85mwqclwgut8wpg2spz3mhxue69uhhyetvv9ujumn8d96zuer9wcq3yamnwvaz7tm8d96xummnw3ezucm0d5q3kamnwvaz7tmwva5hgtnyv9hxxmmwwashjer9wchxxmmdqqsp5akd8h6qc7k40glf0a8d9wuw7qrw5uljn2wa7k8s5w2v04ykewg6jm5uw

PR-Author: DanConwayDev's Agent
nostr:npub1v47f74n2ycn66asev62nv8sas99akj0g0wg0fkup37u3ckwuzs4q7cwtp0

CoverNote:

Small HTTP/WebSocket responses could wait for delayed acknowledgements, while checkpoint writes and metrics rendering performed blocking work on async workers. Background discovery also lost retry history during cleanup and could accept incomplete fetches as successful history.

Review the five commits independently:

| Commit | Scope | Change |
| --- | --- | --- |
| `ddcfa3c` | User responses | Enable TCP_NODELAY on accepted sockets; include delayed-ACK and concurrent LMDB read benchmarks. |
| `fe36d6f` | Shared runtime | Move periodic checkpoints to a blocking worker, release snapshot locks before I/O, and join active writes before the final shutdown snapshot. |
| `f55ce48` | Shared runtime | Render metrics on a blocking worker; retain a shared permit through completion so canceled scrapes cannot start overlapping scans. |
| `5d62037` | Background sync | Preserve discovery ownership and failure history through cleanup and reconnection without adding persistent subscriptions. |
| `df9280e` | Background sync | Require the exact subscription’s EOSE and a drained event stream before accepting discovered history. |

Each commit includes its tests, architecture documentation and changelog entry. Dependency versions and inbound relay query behavior match the base; the transport change applies to accepted connections. The two sync fixes affect outbound discovery.

Validation on the rewritten tree:

- Full workspace tests: 3,034 passed, 0 failed, 16 ignored.
- Formatting and Clippy with warnings denied: passed.
- Nix package build and its library checks: passed.
- Both opt-in response benchmarks passed. Twenty-five two-event reads with delayed ACK took 8.65 ms total. Concurrent LMDB reads reached EOSE at 1, 4, 16 and 32 readers; the maximum per-reader time for three 32-event batches at 32 readers was 220.87 ms.

The five retained fixes match the previously reviewed implementation. The withdrawn SDK workaround and pin are excluded. Investigation reports are absent from the final tree; the original history is preserved locally on `archive/relay-timeout-performance-2026-09-14`.

Local latency and load measurements are diagnostic samples, not production guarantees. These changes do not establish that every historical seven-second timeout had the same cause.
2026-09-14 11:37:20 +01:00
..