Wake deadline consumers on enqueue instead of polling every second
CI / Build and push docker image (push) Successful in 1m15s

This commit is contained in:
woggioni committed 2026-09-30 07:40:04 +08:00
1 parent 723b3b11cf
commit 6e9d1a4652
7 files changed
+162 -19

No files matched your search

@@ -270,6 +270,17 @@ class InMemoryGameStoreTest(unittest.TestCase):
self.assertEqual(60.0, await store.next_deadline())
self.assertEqual(["b"], await store.due_deadlines(now=100.0))
@async_test
async def test_deadline_notifications_reach_subscribers(self) -> None:
store = InMemoryGameStore(_registry())
async with store.subscribe_deadlines() as events:
await store.notify_deadline()
signal = await asyncio.wait_for(anext(events), timeout=1.0)
self.assertIsNone(signal)
# The subscription is gone after the context exits: notifying
# again is a no-op rather than an error.
await store.notify_deadline()
class RedisGameStoreTest(unittest.TestCase):
@async_test