mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[mod] add more iterators to reduce memory usage
This commit is contained in:
parent
15c9fc0eda
commit
55eaee768c
1 changed files with 3 additions and 3 deletions
6
run.py
6
run.py
|
@ -565,9 +565,9 @@ async def ws_index(request, websocket):
|
|||
.order_by(-Job.id)
|
||||
|
||||
# chunks initial data by batch of 30 to avoid killing firefox
|
||||
data = chunks(itertools.chain(map(model_to_dict, next_scheduled_jobs),
|
||||
map(model_to_dict, Job.select().where(Job.state == "running")),
|
||||
map(model_to_dict, latest_done_jobs)), 30)
|
||||
data = chunks(itertools.chain(map(model_to_dict, next_scheduled_jobs.iterator()),
|
||||
map(model_to_dict, Job.select().where(Job.state == "running").iterator()),
|
||||
map(model_to_dict, latest_done_jobs.iterator())), 30)
|
||||
|
||||
await websocket.send(ujson.dumps({
|
||||
"action": "init_jobs",
|
||||
|
|
Loading…
Add table
Reference in a new issue