mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[fix] in case the db is totally empty, index is buggy
This commit is contained in:
parent
a80501208b
commit
8b89935eb3
1 changed files with 7 additions and 1 deletions
8
run.py
8
run.py
|
@ -580,9 +580,15 @@ 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 = []
|
||||
|
||||
await websocket.send(ujson.dumps({
|
||||
"action": "init_jobs",
|
||||
"data": next(data), # send first chunk
|
||||
"data": first_chunck, # send first chunk
|
||||
}))
|
||||
|
||||
for chunk in data:
|
||||
|
|
Loading…
Add table
Reference in a new issue