Commit 88367b6
authored
Move rescope token request to IO thread (#7869)
Task/Issue URL:
https://app.asana.com/1/137249556945/project/608920331025315/task/1213530835574684?focus=true
### Description
Moves the network request that happens in
`GetScopedSyncAuthTokenHandler` to an `io` thread instead of trying to
do it on the `java bridge` thread (which is for JS->Native comms).
### Steps to test this PR
- QA optional
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Moves token rescoping into an injected app-level coroutine on the IO
dispatcher, introducing async behavior that could affect response
timing/cancellation and test determinism if dispatchers/scopes are
misconfigured.
>
> **Overview**
> `GetScopedSyncAuthTokenHandler` now performs `syncApi.rescopeToken`
asynchronously by launching on an injected `@AppCoroutineScope` with
`dispatcherProvider.io()`, instead of executing inline on the message
handler thread.
>
> Tests are updated to inject a `CoroutineTestRule` test
scope/dispatcher provider so the new coroutine-based behavior remains
verifiable while keeping the existing success/error response and pixel
assertions intact.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
389af64. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Craig Russell <[email protected]>1 parent cf56e35 commit 88367b6
File tree
2 files changed
+22
-7
lines changed- sync/sync-impl/src
- main/java/com/duckduckgo/sync/impl/messaging
- test/java/com/duckduckgo/sync/impl/messaging
2 files changed
+22
-7
lines changedLines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| 49 | + | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
79 | 86 | | |
80 | | - | |
| 87 | + | |
| 88 | + | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| 66 | + | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
0 commit comments