Skip to content

Conversation

@tototomate123
Copy link
Contributor

This PR adds an opt-in push suppression feature to cut down on mobile notifications when a user is actively using another client. It's currently marked as experimental and is disabled by default.

What's new

  • Added config flag:
    suppress_push_when_active = true
  • Presence service now tracks the timestamp of the last /sync per user in memory.
  • /sync calls update that timestamp automatically.
  • Push sender checks:
    • user is Online
    • last active < ~65 s
    • last sync gap < ~32 s
      => If all match, push delivery is suppressed; otherwise, notifications are sent as usual.

Why the heuristic?

Initially, I tried implementing this using presence alone, but that turned out to be too "sticky".
Presence keeps users marked as Online for ~5 minutes (default config) after they stop syncing, so mobile notifications stayed suppressed much longer than intended.

This update adds a simple heuristic based on the gap since the last /sync request. With this, push notifications resume after ~30 seconds of inactivity without changing presence idle timers or requiring extra presence updates.

Notes

  • Fully opt-in, preserving legacy behavior by default.
  • No schema or federation changes.
  • If presence lookups fail, pushes are delivered as before.

Next steps / ideas?

  • Make the thresholds configurable?
  • Add metrics for suppressed vs delivered pushes?

@jevolk jevolk changed the base branch from dev to main September 2, 2025 19:34
@jevolk jevolk added feature New feature or functionality that didn't exist. scheduled Work for this issue is planned in the calendar. labels Sep 7, 2025
@jevolk
Copy link
Member

jevolk commented Sep 7, 2025

Sorry about the delay in getting to this but I am definitely excited about it. Thank you so much for making this effort 🙏🏻

@jevolk jevolk changed the base branch from main to dev September 8, 2025 20:32
@jevolk jevolk merged commit 7662ce1 into matrix-construct:dev Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or functionality that didn't exist. scheduled Work for this issue is planned in the calendar.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants