π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] fix lock sync race condition in memory lane cache service
Priyanshu Dangarec9aa84293ea2
diff --git a/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dart b/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dartindex 221645b7b3..ed4a16d412 100644--- a/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dart+++ b/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dart@@ -73,9 +73,11 @@ class MemoryLaneCacheService {Future<void> upsertTimelineAndLog(MemoryLanePersonTimeline timeline,MemoryLaneComputeLogEntry log,+ bool Function() isCurrent,) async {await _ensureInitialized();await _lock.synchronized(() async {+ if (!isCurrent()) return false;final currentCache = await _loadCacheUnsafe();_cache = currentCache.copyWithTimeline(timeline)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 cfdea2ea27..1fd18bb655 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@@ -549,9 +549,6 @@ class MemoryLaneService {_eligibleCreationTimeCutoffMicros(person?.data.birthDate),isCluster: isCluster,);- if (request.isRevoked || !identical(_pendingRequests[personId], request)) {- return;- }await _cacheService.upsertTimelineAndLog(timeline,MemoryLaneComputeLogEntry(@@ -563,6 +560,8 @@ class MemoryLaneService {logicVersion: _timelineLogicVersion,isCluster: isCluster,),+ () =>+ !request.isRevoked && identical(_pendingRequests[personId], request),);if (!timeline.isEligible) {await _refreshReadyPersonIds();