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

[ios] Fix excessive connections for MissedNotifications requests #8643

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

charlag
Copy link
Contributor

@charlag charlag commented Mar 4, 2025

Creating a new URLSession every time leads to establishing new connections every time. Even without HTTP2 iOS would normally make a pool of 4 HTTP1 connections. Keeping URLSession around should lead to an upgrade to HTTP2.

APNS will send background update notifications even when the app is in foreground. If many alarms get updated at once the app might receive and enqueue a lot of MissedNotification requests. It does not make sense to download MissedNotification many times but this is not addressed in this commit.

In combination these two factors might lead to a lot of connections established by the client.

This commit also switches to using async-based URLSession APIs and implements a new async-based queue.

Another missing part is using the same URLSession for all requests that the app would make.

Tasks

  • Do not make new URLSession for every request for notifications
  • Reuse URLSession across the app
  • Do not fetch MissedNotification when we already know we have the latest data.

charlag and others added 4 commits March 4, 2025 17:22
Creating a new URLSession every time leads to establishing new
connections every time. Even without HTTP2 iOS would normally
make a pool of 4 HTTP1 connections. Keeping URLSession around
should lead to an upgrade to HTTP2.

APNS will send background update notifications even when the app
is in foreground. If many alarms get updated at once the app
might receive and enqueue a lot of MissedNotification requests.
It does not make sense to download MissedNotification many times
but this is not addressed in this commit.

In combination these two factors might lead to a lot of connections
established by the client.

This commit also switches to using async-based URLSession APIs
and implements a new async-based queue.

Another missing part is using the same URLSession for all requests
that the app would make.

Co-authored-by: bed <[email protected]>
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