Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
17 lines (9 loc) · 1.29 KB

File metadata and controls

17 lines (9 loc) · 1.29 KB
Copy raw file
Download raw file
Edit and raw actions

Reference: APNS Problems

java-apns maintains a per-connection sent queue (cachedNotifications) like described in the above article

  • java-apns queue is bounded (cacheNotification() will poll notifications out of the queue when the queue gets too big.)

  • It does not regularly check whether sent messages have been sent a few seconds ago to remove them from the sent queue.

So if we send a lot of notifications without failure the old notifications will fall off the queue. This is typically ok (since they are "older" and probably have been sent successfully). The queue only serves to cache all the messages sent in between the client sending a bad notification and the APNS server replying.

Improvements to consider:

  • Refactoring the queue into a full type, freeing the ApnsConnectionImpl from a lot of queue handling code. (no functional changes)

  • record the last send time in the notification (or a wrapper) and poll() messages out of the queue that are older than a certain threshold. (Would guarantee very short queues with low notification volume)

  • When queue gets full anyways (additionally to date handling) voluntarily inject a bad message to enforce an answer (+reconnect) from APNS (bad idea, SSL reconnect is expensive)

Morty Proxy This is a proxified and sanitized view of the page, visit original site.