fix(api): keep file event streams alive
Build and Push Docker Container / build-and-push (push) Successful in 2m7s
Build and Push Docker Container / build-and-push (push) Successful in 2m7s
- Disable the Quart response timeout for authenticated file event streams. - Send SSE keepalives more often to avoid idle proxy disconnects. - Treat remote stream interruptions as reconnectable disconnects in watch output. - Bump NanoShare to 1.26.0 and the standalone CLI to 0.4.1.
This commit is contained in:
@@ -37,7 +37,7 @@ async def api_file_events(user: dict):
|
||||
previous = await _snapshot(user_id)
|
||||
yield 'event: ready\ndata: {}\n\n'
|
||||
while True:
|
||||
await asyncio.sleep(30)
|
||||
await asyncio.sleep(15)
|
||||
current = await _snapshot(user_id)
|
||||
if current != previous:
|
||||
previous = current
|
||||
@@ -45,7 +45,9 @@ async def api_file_events(user: dict):
|
||||
else:
|
||||
yield ': keepalive\n\n'
|
||||
|
||||
return Response(stream(), content_type='text/event-stream', headers={
|
||||
response = Response(stream(), content_type='text/event-stream', headers={
|
||||
'Cache-Control': 'no-cache',
|
||||
'X-Accel-Buffering': 'no',
|
||||
})
|
||||
response.timeout = None
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user