From 8eecd3283a2fa5a71cf7b0374a8c533cd4647d70 Mon Sep 17 00:00:00 2001 From: Roland Date: Sun, 21 Dec 2025 16:06:39 -0700 Subject: [PATCH] Only counting files in the current refresh job as unindexed, clearing refresh job between runs. --- wrolpi/files/lib.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py index 8331f587..6158d320 100644 --- a/wrolpi/files/lib.py +++ b/wrolpi/files/lib.py @@ -746,6 +746,7 @@ async def refresh_files(paths: List[pathlib.Path] = None, send_events: bool = Tr Events.send_refresh_completed() api_app.shared_ctx.refresh['counted_files'] = 0 + api_app.shared_ctx.refresh['idempotency'] = None async def apply_indexers(): @@ -1198,10 +1199,10 @@ def get_refresh_progress() -> RefreshProgress: stmt = ''' SELECT -- Sum all the files in each FileGroup. - SUM(json_array_length(files)) FILTER (WHERE idempotency = %(idempotency)s) AS "total_file_groups", - COUNT(id) FILTER (WHERE indexed IS TRUE AND idempotency = %(idempotency)s) AS "indexed", - COUNT(id) FILTER (WHERE indexed IS FALSE) AS "unindexed", - COUNT(id) FILTER (WHERE model IS NOT NULL AND idempotency = %(idempotency)s) AS "modeled" + SUM(json_array_length(files)) FILTER (WHERE idempotency = %(idempotency)s) AS "total_file_groups", + COUNT(id) FILTER (WHERE indexed IS TRUE AND idempotency = %(idempotency)s) AS "indexed", + COUNT(id) FILTER (WHERE indexed IS FALSE AND idempotency = %(idempotency)s) AS "unindexed", + COUNT(id) FILTER (WHERE model IS NOT NULL AND idempotency = %(idempotency)s) AS "modeled" FROM file_group \ ''' else: