Commit 95c06b1
fix(cli): decrement pending before signaling in IoWorker.runAndAwait
runAndAwait waited on a signal raised in the task's finally, while pending was
decremented later in submit's own finally — so a caller reading pending()
right after runAndAwait returned could still see the task counted. Replace the
signal with a CountDownLatch counted down after the decrement, making the
decrement happen-before the await returns. Also bail out early when closed,
matching submit and avoiding an indefinite wait on a closed worker.
Fixes flaky IoWorkerTest.pending_isZeroAfterTaskCompletes (reproduced on CI).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 35436f1 commit 95c06b1
1 file changed
Lines changed: 12 additions & 12 deletions
Lines changed: 12 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 72 | + | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
0 commit comments