Commit 81af089
authored
fix: add timeouts to HTTP client to prevent freezing (#675)
* fix: add timeouts to HTTP client to prevent freezing
When running Helios for extended periods, the HTTP client could hang
indefinitely on network requests if the beacon node becomes unresponsive
or network issues occur. This would cause the consensus sync loop to
freeze, preventing the client from following the chain.
This fix adds:
- 30 second timeout for individual requests
- 10 second connection timeout
- 60 second idle connection cleanup
These timeouts ensure that network issues or unresponsive beacon nodes
won't cause Helios to freeze permanently, allowing it to recover and
continue syncing.
* fix: ensure WASM compatibility for HTTP client timeouts
- Use conditional compilation to only apply timeout settings on non-WASM targets
- WASM builds use default reqwest client without timeouts (not supported in WASM)
- Conditionally import Duration only for non-WASM builds to avoid warnings1 parent 97aed6e commit 81af089
1 file changed
+14
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
71 | 84 | | |
72 | | - | |
| 85 | + | |
73 | 86 | | |
74 | 87 | | |
75 | 88 | | |
| |||
0 commit comments