You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(harmony): run patch/cleanup off the UI thread via async NAPI (HM-1) (#603)
* perf(harmony): run patch/cleanup off the UI thread via async NAPI (HM-1)
The Pushy TurboModule runs on the UI thread, and applyPatchFromFileSource /
cleanupOldEntries were synchronous NAPI calls, so hdiff patching and recursive
cleanup froze the UI for hundreds of ms to seconds (Android already did this
work on a background thread — this closes the platform gap).
- C++: wrap both exports in napi_create_async_work returning a Promise. Args
are parsed on the JS thread; the heavy hdiff/cleanup runs on a libuv worker
thread; the Promise is settled back on the JS thread.
- ArkTS bindings: applyPatchFromFileSource / cleanupOldEntries now return
Promise<void>; all call sites in DownloadTask await them.
- UpdateContext.cleanUp() keeps its void signature (all callers are
fire-and-forget) but now launches the async cleanup with a .catch, so the
cold-start syncStateWithBinaryVersion -> cleanUp path no longer blocks on
synchronous disk I/O.
Note: there is no HarmonyOS runner in CI and no local device, so this is not
runtime-validated; needs an on-device pass of the full download -> patch ->
switch -> restart -> markSuccess flow.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(harmony): handle async-work create/queue failures (HM-1 review)
napi_create_async_work / napi_queue_async_work return napi_status; if either
fails the completion callback never runs, leaving the Promise pending forever
and leaking the heap-allocated work data. Check both return values, and on
failure delete the work (when created), reject the deferred, and free the data.
Addresses CodeRabbit review on PR #603.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
0 commit comments