Commit 0f26890
authored
feat: add retry with exp. backoff to all RPC network calls (#148)
This PR adds retry logic to all RPC network calls. It relies on the
avast/retry-go library, and is configured with the following parameters:
* delays: [0.5s, 2s, 8s, 32s]
* attempts: 5
* timeout of each network call: 30s
In addition, the PR "fixes" the semantic of the
is{Operation,Ready,Pending,Done} methods. Previously, they would return
false in case of a network error -- which naturally let to unexpected
behavior in the core event handling logic. Now, we return (bool, error)
and the calling code properly handles the network failures.
--
Test coverage is low due to (1) the complexity of mocking the failed
calls on a code base that was not designed with a clear separation
between i/o and business logic and (2) the short lifespan of changes to
the timelock-worker service, which should be deprecated soon.
To compensate, I spent a significant amount of time running local manual
tests, trying to validate all failure scenarios.1 parent a29e8b1 commit 0f26890
File tree
10 files changed
+1108
-115
lines changed- pkg/timelock
- mocks
10 files changed
+1108
-115
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
425 | 427 | | |
426 | 428 | | |
427 | 429 | | |
428 | | - | |
429 | 430 | | |
| 431 | + | |
| 432 | + | |
430 | 433 | | |
431 | 434 | | |
432 | 435 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
0 commit comments