Send the first SSE event immediately (0.2.22)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-13 11:35:37 +02:00
parent 359c289feb
commit c8e1fb8f72
4 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -233,7 +233,7 @@ class UpdaterTests(unittest.IsolatedAsyncioTestCase):
light = await (await client.get('/api/inventory?light=1')).json()
async with client.get('/api/events') as stream:
self.assertEqual(stream.headers['Content-Type'], 'text/event-stream')
line = await asyncio.wait_for(stream.content.readline(), 5)
line = await asyncio.wait_for(stream.content.readline(), 1) # first event is immediate
pushed = json.loads(line.decode().removeprefix('data: '))
self.assertEqual([x['id'] for x in pushed['screens']], [x['id'] for x in light['screens']])
self.assertEqual(len(m.listeners), 1)