Skip to content

Conversation

SebastianKrupinski
Copy link
Contributor

@SebastianKrupinski SebastianKrupinski commented May 14, 2025

Resolves #10717

Summary

  • Added logic to track mail app activity
  • Added logic to modify background sync job interval depending on user activity in the UI

Activity level -> Sync interval

  • Did not use app for more than three days -> Sync every six hours
  • Did not use the app for a day -> Sync every hour
  • Used the app in the last 24 hours -> Sync every 15 minutes

@SebastianKrupinski

This comment was marked as resolved.

@kesselb

This comment was marked as resolved.

Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

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

From when we discussed the feature I remember saying that we want to track when a user accesses Mail. If they access it frequently we keep the hourly sync. If they don't, we drop down to one sync in four hours or even less often.

The current change tries to detect user activity, then skips syncing but also drops the interval from 60 minutes to 15 minutes.

Can you explain why the implementation was done so different to what we discussed? Are there new findings that make the original idea impossible?

@SebastianKrupinski
Copy link
Contributor Author

From when we discussed the feature I remember saying that we want to track when a user accesses Mail. If they access it frequently we keep the hourly sync. If they don't, we drop down to one sync in four hours or even less often.

The current change tries to detect user activity, then skips syncing but also drops the interval from 60 minutes to 15 minutes.

Can you explain why the implementation was done so different to what we discussed? Are there new findings that make the original idea impossible?

Yes, that is what I am trying to do with this.

The idea here is that the background sync will not run as long as there is a up to date heart beat. So as long as the mail UI has been active the background sync will not run, but will revert back to the regular configured interval when there is no activity. Essentially if you are active all day the background sync should not execute. And if you are not active often then it will revert to the default once an hour to sync the mailbox to reduce UI waiting time, and to pick things like iMip.

It only reschdules to 15min when there is a heart beat to check for another heart beat, as the sync can be configure to run every 5min (app.mail.background-sync-interval), I thought it was more sane to check less frequently. We can probably change this to 30min.

@ChristophWurst
Copy link
Member

The cron sync will sync all INBOXes and mailboxes marked for background sync. Frontend will sync INBOXes and the currently open mailbox. Therefore, the background sync should also run when a user has the app open all day.

@st3iny

This comment was marked as resolved.

@st3iny st3iny force-pushed the fix/issue-10717-dynamic-sync-interval branch 2 times, most recently from 20b4009 to a8c0dcd Compare August 22, 2025 08:22
@st3iny st3iny self-assigned this Aug 22, 2025
@st3iny
Copy link
Member

st3iny commented Aug 22, 2025

I discussed this PR with Sebastian and we derived a new logic. Please check the description for more information.

Signed-off-by: SebastianKrupinski <[email protected]>
Signed-off-by: Richard Steinmetz <[email protected]>
@st3iny st3iny force-pushed the fix/issue-10717-dynamic-sync-interval branch from db047a3 to febaba1 Compare August 22, 2025 09:09
@st3iny st3iny enabled auto-merge August 22, 2025 09:09
@st3iny st3iny merged commit b8bdefd into main Aug 22, 2025
39 checks passed
@st3iny st3iny deleted the fix/issue-10717-dynamic-sync-interval branch August 22, 2025 09:20
@github-project-automation github-project-automation bot moved this from 🏗️ In progress to ☑️ Done in 💌 📅 👥 Groupware team Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ☑️ Done
Development

Successfully merging this pull request may close these issues.

Decrease background job sync interval
4 participants