prune prep

This commit is contained in:
Manav Rathi
2024-06-27 09:25:48 +05:30
parent 67d9e650ba
commit a119d544af
6 changed files with 16 additions and 12 deletions

View File

@@ -1,3 +1,9 @@
import {
faceIndex,
indexableFileIDs,
indexedAndIndexableCounts,
syncWithLocalFiles,
} from "@/new/photos/services/face/db";
import {
isBetaUser,
isInternalUser,
@@ -7,12 +13,6 @@ import type { EnteFile } from "@/new/photos/types/file";
import { ComlinkWorker } from "@/next/worker/comlink-worker";
import { ensure } from "@/utils/ensure";
import type { Remote } from "comlink";
import {
faceIndex,
indexableFileIDs,
indexedAndIndexableCounts,
syncWithLocalFiles,
} from "./db";
import type { FaceIndexerWorker } from "./indexer.worker";
/**

View File

@@ -1,11 +1,11 @@
import type { EnteFile } from "@/new/photos/types/file";
import log from "@/next/log";
import { fileLogID } from "utils/file";
import {
closeFaceDBConnectionsIfNeeded,
markIndexingFailed,
saveFaceIndex,
} from "./db";
} from "@/new/photos/services/face/db";
import type { EnteFile } from "@/new/photos/types/file";
import log from "@/next/log";
import { fileLogID } from "utils/file";
import { indexFaces } from "./f-index";
import { putFaceIndex } from "./remote";
import type { FaceIndex } from "./types";

View File

@@ -1,10 +1,10 @@
import { clearFaceData } from "@/new/photos/services/face/db";
import { clearFeatureFlagSessionState } from "@/new/photos/services/feature-flags";
import log from "@/next/log";
import { accountLogout } from "@ente/accounts/services/logout";
import { clipService } from "services/clip-service";
import DownloadManager from "./download";
import exportService from "./export";
import { clearFaceData } from "./face/db";
import mlWorkManager from "./face/mlWorkManager";
/**

View File

@@ -84,7 +84,6 @@ type RemoteEmbedding = z.infer<typeof RemoteEmbedding>;
* with remote (See: [Note: Ignoring embeddings for unknown files]).
*/
export const syncRemoteFaceEmbeddings = async () => {
let sinceTime = faceEmbeddingSyncTime();
// Include files from trash, otherwise they'll get unnecessarily reindexed
// if the user restores them from trash before permanent deletion.
const localFiles = (await getAllLocalFiles()).concat(
@@ -92,6 +91,9 @@ export const syncRemoteFaceEmbeddings = async () => {
);
const localFilesByID = new Map(localFiles.map((f) => [f.id, f]));
// Delete embeddings for files which are no longer present locally.
// pruneFaceEmbeddings(localFilesByID);
const decryptEmbedding = async (remoteEmbedding: RemoteEmbedding) => {
const file = localFilesByID.get(remoteEmbedding.fileID);
// [Note: Ignoring embeddings for unknown files]
@@ -130,6 +132,8 @@ export const syncRemoteFaceEmbeddings = async () => {
}
};
let sinceTime = faceEmbeddingSyncTime();
// TODO: eslint has fixed this spurious warning, but we're not on the latest
// version yet, so add a disable.
// https://github.com/eslint/eslint/pull/18286