From 108e984f294d6808c16df64ec7c4fe5b711c2b59 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 18 Dec 2024 19:00:38 +0530 Subject: [PATCH] [web] Retry on failures in fetching already indexed items https://github.com/ente-io/ente/issues/4087#issuecomment-2525073128 --- web/packages/new/photos/services/ml/worker.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/packages/new/photos/services/ml/worker.ts b/web/packages/new/photos/services/ml/worker.ts index 16fab74349..6374eeb8d0 100644 --- a/web/packages/new/photos/services/ml/worker.ts +++ b/web/packages/new/photos/services/ml/worker.ts @@ -226,7 +226,15 @@ export class MLWorker { this.state = "indexing"; // Use the liveQ if present, otherwise get the next batch to backfill. - const items = liveQ.length ? liveQ : await this.backfillQ(); + const items = liveQ.length + ? liveQ + : await this.backfillQ().catch((e: unknown) => { + // Ignore the error (e.g. a network failure) when determining + // the items to backfill, and return an empty items array so + // that the next retry happens after an exponential backoff. + log.warn("Ignoring error when determining backfillQ", e); + return []; + }); this.countSinceLastIdle += items.length;