Commit f47c974
AR Abdul Azeez
Fix login race condition and JWT FAIL_UNAUTHORIZED blocking callers
1. Split LoginHelper into switchUser() + enqueueLogin() so the
non-suspend login() can synchronously swap user models (instant,
no network) while the backend create-user call fires in the
background. This prevents ANRs on main thread while ensuring
tags target the correct user after each login() call.
loginSuspend() also calls switchUser() + enqueueLogin() directly
(no wrapper method) for clarity.
2. Wake enqueueAndWait waiters on FAIL_UNAUTHORIZED and
FAIL_PAUSE_OPREPO before re-queuing operations. Re-queued items
use waiter=null so future retries don't reference stale waiters.
This prevents loginSuspend from hanging forever when a JWT is
invalid or the op repo pauses.
Fixes SDK-4338
Made-with: Cursor1 parent 258c8e6 commit f47c974
5 files changed
Lines changed: 154 additions & 94 deletions
File tree
- OneSignalSDK/onesignal/core/src
- main/java/com/onesignal
- core/internal/operations/impl
- internal
- user/internal
- test/java/com/onesignal
- core/internal/operations
- user/internal
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
291 | 296 | | |
292 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
293 | 300 | | |
294 | 301 | | |
295 | 302 | | |
| |||
331 | 338 | | |
332 | 339 | | |
333 | 340 | | |
334 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
335 | 346 | | |
336 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
337 | 350 | | |
338 | 351 | | |
339 | 352 | | |
| |||
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
388 | 387 | | |
389 | 388 | | |
390 | 389 | | |
391 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
392 | 398 | | |
393 | 399 | | |
394 | | - | |
| 400 | + | |
395 | 401 | | |
396 | 402 | | |
397 | 403 | | |
| |||
695 | 701 | | |
696 | 702 | | |
697 | 703 | | |
698 | | - | |
| 704 | + | |
| 705 | + | |
699 | 706 | | |
700 | 707 | | |
701 | 708 | | |
| |||
Lines changed: 37 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 33 | + | |
26 | 34 | | |
27 | | - | |
28 | | - | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | | - | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | | - | |
| 41 | + | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
| |||
39 | 47 | | |
40 | 48 | | |
41 | 49 | | |
42 | | - | |
43 | | - | |
| 50 | + | |
44 | 51 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
51 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
52 | 67 | | |
53 | 68 | | |
54 | 69 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
59 | 74 | | |
60 | 75 | | |
61 | 76 | | |
| |||
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
954 | 954 | | |
955 | 955 | | |
956 | 956 | | |
957 | | - | |
958 | | - | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
959 | 960 | | |
960 | 961 | | |
961 | 962 | | |
| |||
1011 | 1012 | | |
1012 | 1013 | | |
1013 | 1014 | | |
1014 | | - | |
| 1015 | + | |
| 1016 | + | |
1015 | 1017 | | |
| 1018 | + | |
| 1019 | + | |
1016 | 1020 | | |
1017 | 1021 | | |
1018 | 1022 | | |
| |||
0 commit comments