Skip to content

Commit a691745

Browse files
authored
[web] Retry on failures in fetching already indexed items (#4439)
#4087 (comment)
2 parents 72dd494 + 108e984 commit a691745

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

web/packages/new/photos/services/ml/worker.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,15 @@ export class MLWorker {
226226
this.state = "indexing";
227227

228228
// Use the liveQ if present, otherwise get the next batch to backfill.
229-
const items = liveQ.length ? liveQ : await this.backfillQ();
229+
const items = liveQ.length
230+
? liveQ
231+
: await this.backfillQ().catch((e: unknown) => {
232+
// Ignore the error (e.g. a network failure) when determining
233+
// the items to backfill, and return an empty items array so
234+
// that the next retry happens after an exponential backoff.
235+
log.warn("Ignoring error when determining backfillQ", e);
236+
return [];
237+
});
230238

231239
this.countSinceLastIdle += items.length;
232240

0 commit comments

Comments
 (0)