fix(export): stream large JSON downloads to a cache file - #304
Conversation
Small-bucket saves from ActivityWatch#229 still buffer the payload as a JS string. For ~500k events that hits the 30s axios timeout and OOMs the WebView. - Intercept /export XHRs and call Android.exportFromUrl - Fetch with auth on a background thread into a cache file - Open the existing Save-to picker from that file CSV of a huge bucket still loads events in JS. Fixes ActivityWatch#228 Git-Session-Id: a180614b-5a5a-5d29-84d8-e1c4e076b990
Review guide (auto-posted)Structured warm-up for reviewers — what changed, what to run, where to look. Key files
Suggested verification
Known risks / watch points
Suggested review focus
Generated by |
|
JavaScript-interface callbacks run on the WebView bridge thread, so reading webView.url there can throw before the native download starts. A detached view also drops view?.post, leaking the streamed cache file. Post both the URL resolve and the fetch completion through the main-looper Handler; enqueue if the fragment is still added, otherwise delete the file. Git-Session-Id: a434bdbc-0d89-5467-a891-085a8060b1c3
|
@greptileai review |
|
Erik merged this at 2026-09-23T01:08:14Z as 6484f5c. CI was green (Test, Test E2E 29, Greptile 5/5). All review threads resolved. No further action on this PR. Companion stack also landed: ActivityWatch/aw-server-rust#721, ActivityWatch/aw-webui#993. #228 stays open until Export-all JSON is confirmed on a ~500k-event device; CSV of a huge bucket is still JS-bound. |
Why
#229 saved small-bucket blob downloads, but "Export all" / a huge bucket still dies silently on 0.14.2b4. The web UI waits for a fully-buffered JSON body (30s axios timeout +
JSON.parsein the WebView).Fixes #228
Companion PRs:
Change
/exportXHRs in the injected hook and callAndroid.exportFromUrlCSV of a huge bucket still materializes events in JS.
Tests
./gradlew :mobile:testStandardDebugUnitTest --tests net.activitywatch.android.fragments.WebUIFragmentTest