Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse existing connections in background_fetch #5989

Open
link2xt opened this issue Sep 22, 2024 · 1 comment
Open

Reuse existing connections in background_fetch #5989

link2xt opened this issue Sep 22, 2024 · 1 comment
Labels
bug Something is not working

Comments

@link2xt
Copy link
Collaborator

link2xt commented Sep 22, 2024

When accounts_background_fetch was introduced, it was intended for iOS which does not run the application in background most of the time anyway, so when push notification arrives, there is no existing connection most of the time.

With Android it depends on the phone. If it does not kill the application most of the time, it is unnecessary to kill existing connections as done here:

let _pause_guard = self.scheduler.pause(self.clone()).await?;

As Android is going to start using background_fetch, it should be modified to better support the case when I/O is already started: deltachat/deltachat-android#3312

Background fetch should probably be moved to the scheduler. If I/O is currently stopped, run background fetch on a separate connection as we do now, but if I/O is already started, interrupt the inbox loop and wait for it to finish one cycle, then interrupt mvbox loop and wait for it to finish one cycle.

@link2xt
Copy link
Collaborator Author

link2xt commented Sep 26, 2024

I tested on the phone with FCM services. Establishing a new connection is not a big problem, but status bar on Android shows "Not connected" and then "Connecting..." for a moment every time a notification arrives. This connectivity status change should definitely not happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

1 participant