Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] remove cluster timelines which were assigned to persons on init in memory lane service

Priyanshu Dangare5f851b6aded7
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.dart
index b6caac547e..249e212e1d 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
@@ -121,11 +121,20 @@ class MemoryLaneService {
}
_topNClusters = {};
final cache = await _cacheService.getCache();
+ final List<Future<void>> tasks = [];
for (final timeline in cache.allTimelines) {
- if (timeline.isCluster && !assigned.contains(timeline.personId)) {
- _topNClusters.add(timeline.personId);
+ if (timeline.isCluster) {
+ if (assigned.contains(timeline.personId)) {
+ tasks.add(_cacheService.removeTimeline(timeline.personId));
+ tasks.add(_cacheService.removeComputeLogEntry(timeline.personId));
+ } else {
+ _topNClusters.add(timeline.personId);
+ }
}
}
+ if (tasks.isNotEmpty) {
+ unawaited(Future.wait(tasks).then((_) => _refreshReadyPersonIds()));
+ }
_topNClusters.addAll(await _mlDataDB.getClustersForMemoryLane(assigned));
for (final cluster in _topNClusters) {
schedulePersonRecompute(cluster, isCluster: true, force: force);