Skip to content

Conversation

@neeraj-pilot
Copy link
Contributor

Summary

  • Add a fast-path (200ms) debouncer for newly discovered local files created within the last 7 days
  • Reduces delay when recently taken photos appear in home gallery from 2-7 seconds to < 500ms
  • Standard debouncing (2s debounce, 5s execution interval) remains unchanged for other sync events

Test plan

  • Take photo with camera app, open Ente within 1 second - photo should appear in < 500ms
  • Import old photos (> 7 days old) - verify standard debouncing applies (no UI thrashing)
  • Large library sync - verify no UI flickering
  • Burst mode (10 recent photos) - all appear without crashes

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a1742f7cc8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 345 to 350
final sevenDaysAgo = DateTime.now()
.subtract(const Duration(days: 7))
.microsecondsSinceEpoch;
hasRecentNewLocalDiscovery = allFiles.any(
(file) => (file.creationTime ?? 0) > sevenDaysAgo,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict priority refresh to newly discovered files

The priority flag is computed using allFiles.any(...), but allFiles includes existing files from the sync window, not just the newly discovered ones. As a result, if the library already contains any recent photo and you import only old photos, hasRecentNewLocalDiscovery becomes true and triggers the 200ms priority refresh even though the new items are not recent. This defeats the intent (“newly discovered” within 7 days) and can cause unnecessary refresh churn on bulk imports; consider checking only the newly inserted list (e.g., the files list after filtering) or explicitly filtering allFiles to the newly discovered IDs.

Useful? React with 👍 / 👎.

Add a fast-path (200ms) debouncer for newly discovered local files
created within the last 7 days. This reduces the delay when recently
taken photos appear in the home gallery from 2-7 seconds to < 500ms.

The standard debouncing (2s debounce, 5s execution interval) remains
unchanged for all other sync events to maintain UI stability.

Changes:
- Add hasRecentNewLocalDiscovery flag to LocalPhotosUpdatedEvent
- Compute 7-day recency check in LocalSyncService
- Add priorityReloadDebounceTime parameter to Gallery widget
- Route priority events to fast-path debouncer in home gallery
@neeraj-pilot neeraj-pilot force-pushed the neeraj/priority-debouncer-recent-photos branch from a1742f7 to 6c1ea26 Compare January 9, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants