logout
This commit is contained in:
@@ -79,8 +79,8 @@ interface FileStatus {
|
||||
* Note that this is module specific state, so the main thread and each worker
|
||||
* thread that calls the functions in this module will get their own independent
|
||||
* connection. To ensure that all connections get torn down correctly, we need
|
||||
* to call closeFaceDBConnection
|
||||
* used to delete the database in {@link clearFaceData}.
|
||||
* to call {@link closeFaceDBConnectionsIfNeeded} from both the main thread and
|
||||
* all the worker threads that use this module.
|
||||
*/
|
||||
let _faceDB: ReturnType<typeof openFaceDB> | undefined;
|
||||
|
||||
@@ -143,14 +143,16 @@ export const closeFaceDBConnectionsIfNeeded = async () => {
|
||||
*
|
||||
* Meant to be called during logout.
|
||||
*/
|
||||
export const clearFaceData = () =>
|
||||
deleteDB("face", {
|
||||
export const clearFaceData = async () => {
|
||||
await closeFaceDBConnectionsIfNeeded();
|
||||
return deleteDB("face", {
|
||||
blocked() {
|
||||
log.warn(
|
||||
"Waiting for an existing client to close their connection so that we can delete the face DB",
|
||||
);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Save the given {@link faceIndex} locally.
|
||||
|
||||
@@ -3,6 +3,7 @@ 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 "./machineLearning/mlWorkManager";
|
||||
|
||||
/**
|
||||
@@ -35,6 +36,12 @@ export const photosLogout = async () => {
|
||||
log.error("Ignoring error during logout (ML)", e);
|
||||
}
|
||||
|
||||
try {
|
||||
await clearFaceData();
|
||||
} catch (e) {
|
||||
log.error("Ignoring error during logout (face)", e);
|
||||
}
|
||||
|
||||
try {
|
||||
exportService.disableContinuousExport();
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user