π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] schedule top N clusters for timeline generation
Priyanshu Dangare8c4e71f92b36
diff --git a/mobile/apps/photos/lib/db/ml/db.dart b/mobile/apps/photos/lib/db/ml/db.dartindex 138133b3b9..b70fe1333d 100644--- a/mobile/apps/photos/lib/db/ml/db.dart+++ b/mobile/apps/photos/lib/db/ml/db.dart@@ -2783,4 +2783,24 @@ class MLDataDB with SqlDbBase implements IMLDataDB<int> {final List<Object?> params = [personOrClusterID];await db.execute(sql, params);}++ Future<Set<String>> getClustersForMemoryLane() async {+ final db = await asyncDB;+ const String sql =+ '''+ SELECT fc.$clusterIDColumn, COUNT(*) AS count+ FROM $faceClustersTable fc+ WHERE fc.$clusterIDColumn IS NOT NULL+ AND NOT EXISTS (+ SELECT 1+ FROM $clusterPersonTable cp+ WHERE cp.$clusterIDColumn = fc.$clusterIDColumn+ )+ GROUP BY fc.$clusterIDColumn+ ORDER BY count DESC+ LIMIT 20+ ''';+ final result = await db.getAll(sql);+ return result.map((row) => row[clusterIDColumn] as String).toSet();+ }}diff --git a/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dart b/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dartindex d3adb20249..e50e3bdc1c 100644--- a/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dart+++ b/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dart@@ -111,6 +111,10 @@ class MemoryLaneService {}schedulePersonRecompute(person.remoteID, force: force);}+ final clusters = await _mlDataDB.getClustersForMemoryLane();+ for (final cluster in clusters) {+ schedulePersonRecompute(cluster, isCluster: true, force: force);+ }}void schedulePersonRecompute(