Commit 7a4ddc5
committed
fix(web): bound the readiness route by its own timeout
Two related issues surfaced from bot review on the readiness route:
1. `checkZoekt` called `loadZoektClient()` outside the
`withTimeout` wrapper, so a stalled first-call Zoekt init
(vendored proto load, network DNS, etc.) could exceed the
documented 2s bound. Move the init call inside the timeout so it
shares the same bound as the gRPC call.
2. `withTimeout` raced the check promise against the timeout and
discarded the loser. If the loser later rejected, no one was
awaiting it, surfacing as an unhandled-promise-rejection warning
in the Node process during a hung-dependency outage. Attach a
no-op `.catch` to the check promise so late rejections are
absorbed; the visible result (the timeout error or the actual
check error) is unchanged.
Addresses Bugbot findings 597dbe01 and 367ae57f, and CodeRabbit
finding 'Cancel timed-out readiness dependency operations' on the
same file.1 parent 2a47d11 commit 7a4ddc5
1 file changed
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | | - | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
91 | | - | |
92 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| |||
0 commit comments