/api/watch also continuously reports disk usage

This commit is contained in:
Leo Vasanko
2023-10-23 05:24:54 +03:00
committed by Leo Vasanko
parent 4852212347
commit 5d3f419508
2 changed files with 27 additions and 11 deletions

View File

@@ -77,8 +77,9 @@ async def watch(req, ws):
try:
with watching.tree_lock:
q = watching.pubsub[ws] = asyncio.Queue()
# Init with full tree
await ws.send(watching.refresh())
# Init with disk usage and full tree
await ws.send(watching.format_du())
await ws.send(watching.format_tree())
# Send updates
while True:
await ws.send(await q.get())