Commit b144dd0
Hex
fix: cache 60MB sessions.json parse + clear threads on workspace switch
Root cause: /api/threads called getGatewayActivityMap() which read
and parsed the 60MB sessions.json on every request — taking 10+
seconds and pegging CPU at 110%.
Fixes:
- Cache the parsed activity map with 10s TTL + mtime check (skip
re-parse if file hasn't changed)
- First request: 183ms, subsequent: 2ms
- Client: clear thread list immediately on workspace switch so old
workspace's threads don't persist while new ones load1 parent 25dbcf4 commit b144dd0
File tree
2 files changed
+26
-1
lines changed- packages
- client/src/features/threads
- server/src/threads
2 files changed
+26
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
62 | 67 | | |
63 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
64 | 72 | | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| 76 | + | |
68 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
69 | 90 | | |
70 | 91 | | |
71 | 92 | | |
| |||
75 | 96 | | |
76 | 97 | | |
77 | 98 | | |
| 99 | + | |
| 100 | + | |
78 | 101 | | |
79 | 102 | | |
80 | 103 | | |
81 | | - | |
| 104 | + | |
82 | 105 | | |
0 commit comments