π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Special case for many ML errors
Manav Rathif5c5ffd86d58
diff --git a/web/packages/new/photos/components/sidebar/MLSettings.tsx b/web/packages/new/photos/components/sidebar/MLSettings.tsxindex 335a304ccf..8d625bfd9c 100644--- a/web/packages/new/photos/components/sidebar/MLSettings.tsx+++ b/web/packages/new/photos/components/sidebar/MLSettings.tsx@@ -232,7 +232,7 @@ interface ManageMLProps {const ManageML: React.FC<ManageMLProps> = ({ mlStatus, onDisableML }) => {const { showMiniDialog } = useBaseContext();- const { phase, nSyncedFiles, nTotalFiles } = mlStatus;+ const { phase, phaseFailed, nSyncedFiles, nTotalFiles } = mlStatus;let status: string;switch (phase) {@@ -249,7 +249,7 @@ const ManageML: React.FC<ManageMLProps> = ({ mlStatus, onDisableML }) => {status = t("people");break;default:- status = t("indexing_status_done");+ status = phaseFailed ? t("error") : t("indexing_status_done");break;}diff --git a/web/packages/new/photos/services/ml/db.ts b/web/packages/new/photos/services/ml/db.tsindex 7e67209032..6372313f6f 100644--- a/web/packages/new/photos/services/ml/db.ts+++ b/web/packages/new/photos/services/ml/db.ts@@ -314,13 +314,13 @@ export const resetFailedFileStatuses = async () => {};/**- * Return the count of files that can be, and that have been, indexed.+ * Return the count of files that can be indexed, have been indexed, and which+ * have been marked as having failed when attempting to index them.*- * These counts are mutually exclusive. Thus the total number of files that are- * fall within the purview of the indexer will be indexable + indexed (if we are- * ignoring the "failed" ones).+ * The total number of files that are within the purview of the indexer is+ * indexable + indexed + failed.*/-export const getIndexableAndIndexedCounts = async () => {+export const savedIndexCounts = async () => {const db = await mlDB();const tx = db.transaction("file-status", "readonly");const indexableCount = await tx.store@@ -329,7 +329,10 @@ export const getIndexableAndIndexedCounts = async () => {const indexedCount = await tx.store.index("status").count(IDBKeyRange.only("indexed"));- return { indexableCount, indexedCount };+ const failedCount = await tx.store+ .index("status")+ .count(IDBKeyRange.only("failed"));+ return { indexableCount, indexedCount, failedCount };};/**diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.tsindex aa73cfa22e..778e7c35e9 100644--- a/web/packages/new/photos/services/ml/index.ts+++ b/web/packages/new/photos/services/ml/index.ts@@ -28,9 +28,9 @@ import type { FaceCluster } from "./cluster";import { regenerateFaceCrops } from "./crop";import {clearMLDB,- getIndexableAndIndexedCounts,resetFailedFileStatuses,savedFaceIndex,+ savedIndexCounts,} from "./db";import {_applyPersonSuggestionUpdates,@@ -446,9 +446,21 @@ export type MLStatus =* user's library.*/phase: "scheduled" | "indexing" | "fetching" | "clustering" | "done";- /** The number of files that have already been indexed. */+ /**+ * `true` if the phase is "done" but a significant fraction of files+ * were marked as failed when indexing.+ *+ * This is not expected to happen normally, and points to a some+ * systematic error in the environment (e.g. ONNX couldn't run).+ */+ phaseFailed?: boolean;+ /**+ * The number of files that have already been indexed.+ */nSyncedFiles: number;- /** The total number of files that are eligible for indexing. */+ /**+ * The total number of files that are eligible for indexing.+ */nTotalFiles: number;};@@ -521,8 +533,8 @@ const getMLStatus = async (): Promise<MLStatus> => {};}- const { indexedCount, indexableCount } =- await getIndexableAndIndexedCounts();+ const { indexedCount, indexableCount, failedCount } =+ await savedIndexCounts();// During live uploads, the indexable count remains zero even as the indexer// is processing the newly uploaded items. This is because these "live@@ -532,6 +544,7 @@ const getMLStatus = async (): Promise<MLStatus> => {// indexable count.let phase: MLStatus["phase"];+ let phaseFailed = false;const state = await w.state;if (state == "indexing" || state == "fetching") {phase = state;@@ -539,10 +552,12 @@ const getMLStatus = async (): Promise<MLStatus> => {phase = "scheduled";} else {phase = "done";+ phaseFailed = failedCount > indexedCount && failedCount > 500;}return {phase,+ phaseFailed,nSyncedFiles: indexedCount,nTotalFiles: indexableCount + indexedCount,};