Repository navigation
feat: [SDK-5377] send queued session requests with retry (3/4) - #1573
Merged
Merged
Conversation
This was referenced Nov 12, 2026
13 of 16 tasks
nan-li
requested changes
Nov 12, 2026
nan-li
left a comment
There was a problem hiding this comment.
Main issue is inline. Smaller things, mostly where this differs from Android and iOS:
- Line 146: Retry-After replaces the backoff. Native uses it as a minimum, caps it at 1 hour, and defaults to 60s for a 429 with no header. Here,
Retry-After: 0would resend in a tight loop.Math.max(backoff, retryAfter)fixes it. - A create that keeps coming back without a
session_idretries for 30 days. Native drops it after 3. - Line 86 waits on local IDs, but nothing ever rewrites a queued record, so the wait never ends. The page already blocks local OneSignal IDs, but a local subscription ID can still get through. Android rewrites the IDs and iOS reads the current ones at send time. Do one of those or drop the record.
- Backoff caps at 10 minutes, native at 5. Fine if that's on purpose.
- Line 185 says
onlinecovers a lost wake timer, but a stopped worker doesn't start foronline. Only the next worker start covers it. isMissingInRetryWindowis a type guard that also returns false for updates, so TypeScript treatsrecordas a create in the drop branch. A plainbooleanreturn would be accurate.- The comment on
backoffMs(line 179) restates the code.
fadi-george
force-pushed
the
fadi/sdk-5377-sender
branch
4 times, most recently
from
November 12, 2026 23:15
1ae3737 to
c23801b
Compare
Contributor
Author
|
Thanks, addressed:
|
fadi-george
force-pushed
the
fadi/sdk-5377-sender
branch
from
November 12, 2026 23:29
c23801b to
26b3d4d
Compare
fadi-george
force-pushed
the
fadi/sdk-5377-sender
branch
2 times, most recently
from
November 12, 2026 23:38
8913f38 to
7d1661a
Compare
fadi-george
force-pushed
the
fadi/sdk-5377-sender
branch
from
November 12, 2026 23:44
7d1661a to
531d6dc
Compare
fadi-george
force-pushed
the
fadi/sdk-5377-sender
branch
from
November 12, 2026 23:57
531d6dc to
5faf9e4
Compare
fadi-george
force-pushed
the
fadi/sdk-5377-sender
branch
from
November 13, 2026 00:02
5faf9e4 to
0286837
Compare
14 of 16 tasks
Drains SessionRequests oldest first, one request per session at a time. A create waits for real onesignal/subscription ids; updates wait for the server session id plus a 5s post-create delay. Requests stay stored until a success or a non-retryable failure. Retries back off exponentially with jitter and honor Retry-After. An update 404 within 60s of its create is retried as possible replication lag. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fadi-george
force-pushed
the
fadi/sdk-5377-sender
branch
from
November 13, 2026 02:18
0286837 to
6fde8f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
1 Line Summary
Sends queued session requests one per session in order, with backoff, Retry-After, and the post-create 404 window.
Details
Mirrors Android #2794 and iOS #1768 where they apply.
local-onesignal or subscription ID is dropped with its updates, since queued records are never rewritten.session_idis saved inSessionRequestStatesbefore the create record is deleted. Updates read it at send time and wait 5s after the create (post-create delay, like Android), so updates and ends enqueued later or after a restart still get it.Retry-Afteris a floor on the backoff, capped at 1 hour; a 429 without it waits at least 60s.session_idis dropped with its updates after 3 tries.online). The worker usually stops within seconds of going idle, so a timer would rarely fire. Drains run one after another under their own Web Lock.Unlike Android there is no closed flag: session IDs are per-session UUIDs and the worker is the only producer, so nothing is enqueued for a session after its end.
Stack
Built on #1569 (SDK-5373 sessions API client).
Systems Affected
Validation
Tests
Info
sender.test.ts: create then update after the post-create delay, local-ID create dropped without blocking other sessions, Retry-After 0 still backing off, 429 default, Retry-After cap, missingsession_idlimit, orphan update drop, retry keeps record and key, Retry-After, backoff bounds, dropped create takes updates, 404 window, update replaced while being sent is not retried, update enqueued while its create is in flight gets the server ID, updates and ends enqueued after the create was sent, an end replacing an update waiting out the post-create delay, state removed after the end and past the age limit.vp checkclean (only existing warnings), fullvp run testpasses, each PR in the stack passes on its own. Not tested in a browser: nothing enqueues session requests until the lifecycle wiring (SDK-5381).Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemap. Usesfor...ofwhere IndexedDB writes must run in sequence.contextif possible.Screenshots
Info
No UI changes.
Checklist
Related Tickets
SDK-5377
🤖 Generated with Claude Code