Repository navigation
Commit 3764a2e
perf(mobile): ask typing subscriptions only for the typing window (#9454)
Every channel that shows a typing indicator (the open channel, and each
Solo row on the home list) subscribes for typing and message events with
`limit: 10` and no `since`, so each subscribe replays that channel's
last 10 stored messages. The handler then ignores every one of them that
is older than the 8 second typing window, so the replay only costs
bytes. On an iPhone 12 mini signed in to Builderlab, seven Solo rows
made this about 66 KB of kind 9 messages on each cold start, and again
on each resubscribe.
The subscription now asks only for events inside the typing window
(`since` = now minus 8 s), which are the only ones the handler can act
on.
### Validation
New test: the typing subscription asks for history starting 8 s before
it subscribes. It fails without this change.
Full mobile test suite and `flutter analyze` pass.
On the iPhone 12 mini (profile build with this change, signed in to
Builderlab), stored and live events on the typing subscriptions in the
first minute or more after a cold start:
| | Subscriptions | Kind 9 messages | Typing events |
| --- | --- | --- | --- |
| Before (60 s) | 7 | 74 (66.6 KB) | 26 (15.6 KB) |
| After (80 s) | 8 | 2 (1.5 KB) | 29 (17.8 KB) |
Typing events are mostly live ones from agents working in Solo chats, so
they stay about the same. The automated run covered a cold start to the
home list and its Solo rows.
### Regressions
- A device clock running more than 8 s fast can make the relay skip a
message that would have ended an indicator. That indicator still clears
when its 8 s window ends, and the handler already drops events it
considers older than the window, so the same skew loses the same events
today.
Signed-off-by: Tom Brow <[email protected]>
Co-authored-by: Tom Brow <[email protected]>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>1 parent 11ea8c9 commit 3764a2e
2 files changed
Lines changed: 20 additions & 0 deletions
File tree
- mobile
- lib/features/channels
- test/features/channels
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
190 | 193 | | |
191 | 194 | | |
192 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
46 | 63 | | |
47 | 64 | | |
48 | 65 | | |
| |||
0 commit comments