Commit 5302f30
Drain the queue on shutdown instead of tracking watcher swaps
Tracking the swap promise was the wrong shape. It could always be read at a
moment when the in-flight rebuild had not assigned its swap yet, so shutdown
saw the old one settle, closed the queue, and dropped whatever the later
generation flushed. Each fix narrowed that window without closing it.
A full rebuild runs inside the queue, so the queue already knows when one is in
flight — including a rebuild that has not yet replaced its watchers. Add
`drain()`, wait for it before tearing the watchers down, and close only after
their flush has landed.
That removes the swap bookkeeping entirely.
Both orderings are pinned: cleanup must not run while a rebuild is in flight,
and what the watchers flush on the way out must still be processed. Against
no-drain the cleanup runs early; against closing first the flush is ignored.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lcj4iQ3fBxMwAu2rf4zLbC1 parent 26fcae0 commit 5302f30
3 files changed
Lines changed: 60 additions & 71 deletions
Lines changed: 40 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 137 | + | |
141 | 138 | | |
142 | | - | |
143 | 139 | | |
144 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
145 | 152 | | |
146 | 153 | | |
147 | | - | |
148 | | - | |
| 154 | + | |
149 | 155 | | |
150 | 156 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
171 | 164 | | |
172 | 165 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
181 | 174 | | |
182 | | - | |
183 | | - | |
| 175 | + | |
184 | 176 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | 330 | | |
335 | 331 | | |
336 | 332 | | |
| |||
418 | 414 | | |
419 | 415 | | |
420 | 416 | | |
421 | | - | |
422 | | - | |
| 417 | + | |
423 | 418 | | |
424 | 419 | | |
425 | 420 | | |
| |||
515 | 510 | | |
516 | 511 | | |
517 | 512 | | |
518 | | - | |
| 513 | + | |
519 | 514 | | |
520 | 515 | | |
521 | 516 | | |
| |||
712 | 707 | | |
713 | 708 | | |
714 | 709 | | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
720 | 715 | | |
721 | | - | |
722 | 716 | | |
723 | | - | |
| 717 | + | |
724 | 718 | | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
| 719 | + | |
734 | 720 | | |
735 | 721 | | |
736 | 722 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
60 | 71 | | |
61 | 72 | | |
62 | 73 | | |
| |||
0 commit comments