From 5bb6d7c890475a3f6369edae11d367fca0a3812c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 12 Jan 2021 23:15:42 +0100 Subject: [PATCH] Do not miserably display nothing if there's less than 30 entries --- run.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/run.py b/run.py index 0631a33..f45d0a3 100644 --- a/run.py +++ b/run.py @@ -539,7 +539,8 @@ def chunks(l, n): yield chunk chunk = [] a = 0 - + + yield chunk @app.websocket('/index-ws') @clean_websocket @@ -581,11 +582,7 @@ async def ws_index(request, websocket): map(model_to_dict, Job.select().where(Job.state == "running").iterator()), map(model_to_dict, latest_done_jobs.iterator())), 30) - try: - first_chunck = next(data) - except StopIteration: - # in case data is empty - first_chunck = [] + first_chunck = next(data) await websocket.send(ujson.dumps({ "action": "init_jobs",