Skip to content

armgit / ente

Public Imported from GitHub
0

đź’š End-to-end encrypted cloud for everything.

Increase the compute cooldown

laurenspriem0ddf91ff9dbd
diff --git a/mobile/apps/photos/.docs/face_timeline_spec.md b/mobile/apps/photos/.docs/face_timeline_spec.md
index da5b573621..b6e6ca172e 100644
--- a/mobile/apps/photos/.docs/face_timeline_spec.md
+++ b/mobile/apps/photos/.docs/face_timeline_spec.md
@@ -4,7 +4,8 @@
Deliver an on-device, auto-playing “faces timeline” for eligible named people that highlights their visual journey over the years and enables sharing a rendered video.
### Eligibility & Precomputation
-- Run background precomputation per person after ML syncs or people data changes.
+- Run the initial full precomputation once after the feature initializes; subsequent recomputes run only when people data changes (e.g., new faces added/removed or edits) and respect the service cooldown described below.
+- Each person’s timeline obeys a 90-day cooldown between automatic recomputes so the cached experience stays stable even if multiple syncs occur; requests arriving during the cooldown are skipped unless a future manual override flow is added.
- Skip people marked ignored/hidden or lacking ≥5 distinct calendar years that each contribute ≥4 faces (based on file `creationTime`); a year only counts toward eligibility if it independently meets that four-face threshold.
- When a birthdate is known, ignore faces captured before the person's fifth birthday so ages 0–4 neither count toward eligibility nor appear in playback.
- Group faces by year, sort chronologically, and select four samples spread across the year (prefer quarterly spacing; gracefully accept uneven distributions).
@@ -38,7 +39,7 @@ Deliver an on-device, auto-playing “faces timeline” for eligible named peopl
- If export fails, notify the user and leave the share action disabled until a retry succeeds.
### Performance & Reliability
-- Execute precomputation in a background isolate with throttling (e.g., max once per person per day) to limit resource spikes.
+- Execute precomputation in a background isolate with throttling: the worker queue stays single-threaded and each person can only recompute automatically once every ~90 days unless we introduce an explicit user-triggered override later.
- Ensure the timeline plays offline by relying on cached crops and locally stored payloads.
- Add logging (non-PII) for eligibility results, banner impressions, playback starts, and share attempts.
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index d2a8d371e5..11ec5d1bff 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -318,7 +318,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
await FacesTimelineService.instance.init();
if (flagService.facesTimeline) {
FacesTimelineService.instance
- .queueFullRecompute(force: true, trigger: "startup")
+ .queueFullRecompute(trigger: "startup")
.ignore();
} else {
_logger.info("Faces timeline disabled via feature flag");
diff --git a/mobile/apps/photos/lib/services/faces_timeline/faces_timeline_service.dart b/mobile/apps/photos/lib/services/faces_timeline/faces_timeline_service.dart
index 3d63a56d86..346df64d41 100644
--- a/mobile/apps/photos/lib/services/faces_timeline/faces_timeline_service.dart
+++ b/mobile/apps/photos/lib/services/faces_timeline/faces_timeline_service.dart
@@ -33,7 +33,7 @@ class FacesTimelineService {
static const _minimumYears = 5;
static const _minimumFacesPerYear = 4;
static const _minimumEligibleAgeYears = 5;
- static const _recomputeCooldown = Duration(hours: 24);
+ static const _recomputeCooldown = Duration(days: 90);
final Logger _logger = Logger("FacesTimelineService");
final FacesTimelineCacheService _cacheService =
@@ -169,19 +169,12 @@ class FacesTimelineService {
if (personId != null) {
schedulePersonRecompute(
personId,
- force: true,
trigger: "people_event_${event.type.name}",
);
} else {
- queueFullRecompute(
- force: true,
- trigger: "people_event_${event.type.name}",
- );
+ queueFullRecompute(trigger: "people_event_${event.type.name}");
}
break;
- case PeopleEventType.syncDone:
- queueFullRecompute(force: true, trigger: "sync_done");
- break;
case PeopleEventType.defaultType:
if (personId != null) {
schedulePersonRecompute(personId, trigger: "people_default");