Skip to content

[mob][photos] add grace window plugin for ios#9755

Closed
prateekmedia wants to merge 43 commits intoente-io:mainfrom
prateekmedia:prtk/bg-grace-window
Closed

[mob][photos] add grace window plugin for ios#9755
prateekmedia wants to merge 43 commits intoente-io:mainfrom
prateekmedia:prtk/bg-grace-window

Conversation

@prateekmedia
Copy link
Copy Markdown
Contributor

Description

Allow operations to run for a short interval in background using grace window.

Tests

# Conflicts:
#	mobile/apps/photos/lib/main.dart
#	mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
Both onAppForeground and _waitForGraceWindowExpiration now snapshot
DateTime.now() before yielding to the event loop, ensuring concurrent
sync() lock acquisitions are never accidentally released.
@prateekmedia prateekmedia force-pushed the prtk/bg-grace-window branch from 344745c to f29508f Compare March 23, 2026 12:01
@prateekmedia prateekmedia force-pushed the prtk/bg-grace-window branch from f29508f to c71eea4 Compare March 23, 2026 12:09
Copy link
Copy Markdown

@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: 344745c90d

ℹ️ 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 +169 to +173
if (nextSchedule != null) {
await scheduleIOSBackgroundProcessingTask(
source: "$source:${reason ?? nextSchedule.reason}",
initialDelay: nextSchedule.delay,
reason: nextSchedule.reason,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip rescheduling processing task while app is foregrounded

handleIOSBackgroundProcessingTaskCompletion always re-schedules a processing task when nextSchedule is non-null, but UploadBackgroundCoordinator.onAppForeground() explicitly cancels this task when the app returns to foreground. If a background processing callback finishes after that foreground transition, this code re-creates the canceled task, leading to unnecessary background wakeups and defeating the foreground cancellation path. Add a foreground-state guard before scheduling.

Useful? React with 👍 / 👎.

@prateekmedia
Copy link
Copy Markdown
Contributor Author

#9810

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.

1 participant