Commit 8041f43
committed
Address Copilot review: guard cache write against older-generation clobber
A slow `current()` call that observed an older `inner` generation could
finish after a concurrent caller has published a newer entry, and its
unconditional write would replace that newer entry with a stale one.
Semantics were still correct (later readers see the mismatch and
recompute), but subsequent generation-matched calls would miss the cache
and redo the remap unnecessarily.
Guard the write: only publish if the observed generation is at least
as fresh as whatever is currently cached.1 parent 3f4cee9 commit 8041f43
1 file changed
Lines changed: 16 additions & 4 deletions
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
276 | 288 | | |
277 | 289 | | |
278 | 290 | | |
| |||
0 commit comments