π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Move
Manav Rathieaefdb56a0ac
diff --git a/web/apps/photos/src/services/machineLearning/machineLearningService.ts b/web/apps/photos/src/services/machineLearning/machineLearningService.tsindex 4ac17dbb8c..d89fdebc94 100644--- a/web/apps/photos/src/services/machineLearning/machineLearningService.ts+++ b/web/apps/photos/src/services/machineLearning/machineLearningService.ts@@ -14,7 +14,6 @@ import { getLocalFiles } from "services/fileService";import mlIDbStorage, {ML_SEARCH_CONFIG_NAME,ML_SYNC_CONFIG_NAME,- ML_SYNC_JOB_CONFIG_NAME,} from "services/ml/db";import {BlurDetectionMethod,@@ -48,19 +47,11 @@ import dbscanClusteringService from "./dbscanClusteringService";import FaceService from "./faceService";import hdbscanClusteringService from "./hdbscanClusteringService";import laplacianBlurDetectionService from "./laplacianBlurDetectionService";-import type { JobConfig } from "./mlWorkManager";import mobileFaceNetEmbeddingService from "./mobileFaceNetEmbeddingService";import PeopleService from "./peopleService";import ReaderService from "./readerService";import yoloFaceDetectionService from "./yoloFaceDetectionService";-export const DEFAULT_ML_SYNC_JOB_CONFIG: JobConfig = {- intervalSec: 5,- // TODO: finalize this after seeing effects on and from machine sleep- maxItervalSec: 960,- backoffMultiplier: 2,-};-export const DEFAULT_ML_SYNC_CONFIG: MLSyncConfig = {batchSize: 200,imageSource: "Original",@@ -108,13 +99,6 @@ export const DEFAULT_ML_SEARCH_CONFIG: MLSearchConfig = {export const MAX_ML_SYNC_ERROR_COUNT = 1;-export async function getMLSyncJobConfig() {- return mlIDbStorage.getConfig(- ML_SYNC_JOB_CONFIG_NAME,- DEFAULT_ML_SYNC_JOB_CONFIG,- );-}-export async function getMLSyncConfig() {return mlIDbStorage.getConfig(ML_SYNC_CONFIG_NAME, DEFAULT_ML_SYNC_CONFIG);}@@ -131,14 +115,6 @@ export async function getMLSearchConfig() {return DEFAULT_ML_SEARCH_CONFIG;}-export async function updateMLSyncJobConfig(newConfig: JobConfig) {- return mlIDbStorage.putConfig(ML_SYNC_JOB_CONFIG_NAME, newConfig);-}--export async function updateMLSyncConfig(newConfig: MLSyncConfig) {- return mlIDbStorage.putConfig(ML_SYNC_CONFIG_NAME, newConfig);-}-export async function updateMLSearchConfig(newConfig: MLSearchConfig) {return mlIDbStorage.putConfig(ML_SEARCH_CONFIG_NAME, newConfig);}diff --git a/web/apps/photos/src/services/machineLearning/mlWorkManager.ts b/web/apps/photos/src/services/machineLearning/mlWorkManager.tsindex f5dde1c083..7dbc7e25dc 100644--- a/web/apps/photos/src/services/machineLearning/mlWorkManager.ts+++ b/web/apps/photos/src/services/machineLearning/mlWorkManager.ts@@ -5,7 +5,6 @@ import { eventBus, Events } from "@ente/shared/events";import { getToken, getUserID } from "@ente/shared/storage/localStorage/helpers";import debounce from "debounce";import PQueue from "p-queue";-import { getMLSyncJobConfig } from "services/machineLearning/machineLearningService";import mlIDbStorage from "services/ml/db";import { MLSyncResult } from "services/ml/types";import { EnteFile } from "types/file";@@ -38,8 +37,14 @@ export class MLSyncJob {private intervalSec: number;private nextTimeoutId: ReturnType<typeof setTimeout>;- constructor(config: JobConfig, runCallback: () => Promise<MLSyncJobResult>) {- this.config = config;+ constructor(runCallback: () => Promise<MLSyncJobResult>) {+ this.config = {+ intervalSec: 5,+ // TODO: finalize this after seeing effects on and from machine sleep+ maxItervalSec: 960,+ backoffMultiplier: 2,+ };+this.runCallback = runCallback;this.state = "NotScheduled";this.stopped = true;@@ -339,11 +344,8 @@ class MLWorkManager {log.info("User not logged in, not starting ml sync job");return;}- const mlSyncJobConfig = await getMLSyncJobConfig();if (!this.mlSyncJob) {- this.mlSyncJob = new MLSyncJob(mlSyncJobConfig, () =>- this.runMLSyncJob(),- );+ this.mlSyncJob = new MLSyncJob(() => this.runMLSyncJob());}this.mlSyncJob.start();} catch (e) {diff --git a/web/apps/photos/src/services/ml/db.ts b/web/apps/photos/src/services/ml/db.tsindex 90b2f4aa07..c55d38f2be 100644--- a/web/apps/photos/src/services/ml/db.ts+++ b/web/apps/photos/src/services/ml/db.ts@@ -12,7 +12,6 @@ import isElectron from "is-electron";import {DEFAULT_ML_SEARCH_CONFIG,DEFAULT_ML_SYNC_CONFIG,- DEFAULT_ML_SYNC_JOB_CONFIG,MAX_ML_SYNC_ERROR_COUNT,} from "services/machineLearning/machineLearningService";import { Face, MLLibraryData, MlFileData, Person } from "services/ml/types";@@ -27,7 +26,6 @@ export interface IndexStatus {interface Config {}-export const ML_SYNC_JOB_CONFIG_NAME = "ml-sync-job";export const ML_SYNC_CONFIG_NAME = "ml-sync";export const ML_SEARCH_CONFIG_NAME = "ml-search";@@ -136,12 +134,14 @@ class MLIDbStorage {// TODO: update configs if version is updated in defaultsdb.createObjectStore("configs");+ /*await tx.objectStore("configs").add(DEFAULT_ML_SYNC_JOB_CONFIG,- ML_SYNC_JOB_CONFIG_NAME,+ "ml-sync-job",);+ */await tx.objectStore("configs").add(DEFAULT_ML_SYNC_CONFIG, ML_SYNC_CONFIG_NAME);@@ -163,6 +163,10 @@ class MLIDbStorage {.objectStore("configs").delete(ML_SEARCH_CONFIG_NAME);+ await tx+ .objectStore("configs")+ .delete("ml-sync-job");+await tx.objectStore("configs").add(