fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import DownloadManager from "@/new/photos/services/download";
|
||||
import { terminateFaceWorker } from "@/new/photos/services/face";
|
||||
import { clearFaceData } from "@/new/photos/services/face/db";
|
||||
import { terminateFaceWorker } from "@/new/photos/services/ml";
|
||||
import { clearFaceData } from "@/new/photos/services/ml/db";
|
||||
import { clearFeatureFlagSessionState } from "@/new/photos/services/feature-flags";
|
||||
import mlWorkManager from "@/new/photos/services/ml/mlWorkManager";
|
||||
import log from "@/next/log";
|
||||
|
||||
@@ -49,14 +49,6 @@ export enum FILE_OPS_TYPE {
|
||||
DELETE_PERMANENTLY,
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns a string to use as an identifier when logging information about the
|
||||
* given {@link enteFile}. The returned string contains the file name (for ease
|
||||
* of debugging) and the file ID (for exactness).
|
||||
*/
|
||||
export const fileLogID = (enteFile: EnteFile) =>
|
||||
`file ${enteFile.metadata.title ?? "-"} (${enteFile.id})`;
|
||||
|
||||
export async function getUpdatedEXIFFileForDownload(
|
||||
fileReader: FileReader,
|
||||
file: EnteFile,
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
indexableFileIDs,
|
||||
indexedAndIndexableCounts,
|
||||
updateAssumingLocalFiles,
|
||||
} from "@/new/photos/services/face/db";
|
||||
} from "@/new/photos/services/ml/db";
|
||||
import {
|
||||
isBetaUser,
|
||||
isInternalUser,
|
||||
|
||||
@@ -2,11 +2,11 @@ import {
|
||||
closeFaceDBConnectionsIfNeeded,
|
||||
markIndexingFailed,
|
||||
saveFaceIndex,
|
||||
} from "@/new/photos/services/face/db";
|
||||
} from "@/new/photos/services/ml/db";
|
||||
import type { FaceIndex } from "@/new/photos/services/ml/types";
|
||||
import type { EnteFile } from "@/new/photos/types/file";
|
||||
import log from "@/next/log";
|
||||
import { fileLogID } from "utils/file";
|
||||
import { fileLogID } from "../../utils/file";
|
||||
import { indexFaces } from "./f-index";
|
||||
import { putFaceIndex } from "./remote";
|
||||
|
||||
@@ -46,7 +46,7 @@ export class FaceIndexerWorker {
|
||||
// failed, not if there were subsequent failures (like when trying
|
||||
// to put the result to remote or save it to the local face DB).
|
||||
log.error(`Failed to index faces in ${f}`, e);
|
||||
markIndexingFailed(enteFile.id);
|
||||
await markIndexingFailed(enteFile.id);
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,6 @@ export class FaceIndexerWorker {
|
||||
* connections to the face DB from the web worker's context.
|
||||
*/
|
||||
closeFaceDB() {
|
||||
closeFaceDBConnectionsIfNeeded();
|
||||
void closeFaceDBConnectionsIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,23 +110,23 @@ class MachineLearningService {
|
||||
return this.syncContext;
|
||||
}
|
||||
|
||||
private async getLocalSyncContext(
|
||||
token: string,
|
||||
userID: number,
|
||||
userAgent: string,
|
||||
) {
|
||||
// TODO-ML(MR): This is updating the file ML version. verify.
|
||||
if (!this.localSyncContext) {
|
||||
log.info("Creating localSyncContext");
|
||||
// TODO-ML(MR):
|
||||
this.localSyncContext = new Promise((resolve) => {
|
||||
resolve(new MLSyncContext(token, userID, userAgent));
|
||||
});
|
||||
} else {
|
||||
log.info("reusing existing localSyncContext");
|
||||
}
|
||||
return this.localSyncContext;
|
||||
}
|
||||
// private async getLocalSyncContext(
|
||||
// token: string,
|
||||
// userID: number,
|
||||
// userAgent: string,
|
||||
// ) {
|
||||
// // TODO-ML(MR): This is updating the file ML version. verify.
|
||||
// if (!this.localSyncContext) {
|
||||
// log.info("Creating localSyncContext");
|
||||
// // TODO-ML(MR):
|
||||
// this.localSyncContext = new Promise((resolve) => {
|
||||
// resolve(new MLSyncContext(token, userID, userAgent));
|
||||
// });
|
||||
// } else {
|
||||
// log.info("reusing existing localSyncContext");
|
||||
// }
|
||||
// return this.localSyncContext;
|
||||
// }
|
||||
|
||||
public async closeLocalSyncContext() {
|
||||
if (this.localSyncContext) {
|
||||
@@ -139,15 +139,20 @@ class MachineLearningService {
|
||||
|
||||
public async syncLocalFile(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
token: string,
|
||||
_: string,
|
||||
// token: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
userID: number,
|
||||
__: number,
|
||||
// userID: number,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
userAgent: string,
|
||||
___: string,
|
||||
// userAgent: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
enteFile: EnteFile,
|
||||
____: EnteFile,
|
||||
// enteFile: EnteFile,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
localFile?: globalThis.File,
|
||||
_____?: globalThis.File,
|
||||
// localFile?: globalThis.File,
|
||||
) {
|
||||
/* TODO-ML(MR): Currently not used
|
||||
const syncContext = await this.getLocalSyncContext(
|
||||
|
||||
@@ -23,6 +23,16 @@ class ModuleState {
|
||||
|
||||
const moduleState = new ModuleState();
|
||||
|
||||
/**
|
||||
* @returns a string to use as an identifier when logging information about the
|
||||
* given {@link enteFile}. The returned string contains the file name (for ease
|
||||
* of debugging) and the file ID (for exactness).
|
||||
*/
|
||||
export const fileLogID = (enteFile: EnteFile) =>
|
||||
// TODO: Remove this when file/metadata types have optionality annotations.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
`file ${enteFile.metadata.title ?? "-"} (${enteFile.id})`;
|
||||
|
||||
/**
|
||||
* [Note: File name for local EnteFile objects]
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user