Repository navigation
feat(native): bounded prepareBundle on Android and HarmonyOS - #669
Conversation
Only iOS let a host bound its wait (prepareBundle(timeout:completion:)). Android waited on the round's latch without limit, and ran the round on the caller's single host worker, so a second caller queued behind the first caller's whole wait. HarmonyOS awaited the round without limit. - Android: PushyRuntime.prepareBundle(context, timeoutMillis, callback). The round runs on its own thread (claimRound / runClaimedRound, as iOS), the caller waits at most the timeout and gets failed/timeout on expiry while the round carries on. Without a timeout it waits at most 30 minutes, the iOS default. Host waits run on a cached daemon pool, so one caller's wait never delays another's. - HarmonyOS: prepareBundle(timeoutMs?) races the round against a timer; without one it keeps waiting for the round (nothing blocks on ArkTS). - READMEs document the three timeout entry points. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…gine SyncCoordinator's hand-written round (runConfiguredRound, the endpoint query loop, the two-budget performAttempts loop and the result mapping) becomes a loop over FlowBridge.stepRound (new JNI binding over flowcore::StepRoundJson) that runs the commands it returns: the breadcrumb, the launch env, HTTP, the installed check, downloads and the commit. Platform parts stay: the round thread and its claim, crash hold and the pending-activation bookkeeping, the bounded host wait (#669), OkHttp with the downgrade and body-size guards, the download executor and its cancel. Aligned with the engine (NATIVE_CHECKUPDATE_DESIGN §12.4): request timeouts are the engine's (idle 10s, whole call 15s, capped by the round deadline); a commit lost to a config change finishes as cancelled/config_changed; a cache-only commit that throws is failed/commit_failed instead of internal_error. librnpushy.so is rebuilt with NDK 28.2.13676358 for the new native method. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gine (#676) * refactor(android): drive the native round through the shared round engine SyncCoordinator's hand-written round (runConfiguredRound, the endpoint query loop, the two-budget performAttempts loop and the result mapping) becomes a loop over FlowBridge.stepRound (new JNI binding over flowcore::StepRoundJson) that runs the commands it returns: the breadcrumb, the launch env, HTTP, the installed check, downloads and the commit. Platform parts stay: the round thread and its claim, crash hold and the pending-activation bookkeeping, the bounded host wait (#669), OkHttp with the downgrade and body-size guards, the download executor and its cancel. Aligned with the engine (NATIVE_CHECKUPDATE_DESIGN §12.4): request timeouts are the engine's (idle 10s, whole call 15s, capped by the round deadline); a commit lost to a config change finishes as cancelled/config_changed; a cache-only commit that throws is failed/commit_failed instead of internal_error. librnpushy.so is rebuilt with NDK 28.2.13676358 for the new native method. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(android): treat only a zero hold deadline as none System.nanoTime's origin is arbitrary, so a crash-hold deadline may be negative; it must still cap the round. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
架构审查里的一处宿主接口差异:三端中只有 iOS 允许宿主限定
prepareBundle的等待时间。改了什么
PushyRuntime.prepareBundle(context, timeoutMillis, callback)。failed/timeout,轮次继续在后台运行,结果仍对下次启动生效。prepareBundle(timeoutMs?)让等待与计时器赛跑,超时后的语义与 Android 相同。不传超时时仍等到轮次结束,因为 ArkTS 是单线程的,这样的等待不会阻塞任何东西。已有的无参调用保持原有接口和结果语义,只是 Android 不再无限等待。
验证
bun lint通过,bun test439 个用例全部通过。新增的鸿蒙用例验证了超时返回failed/timeout、轮次不被中断,以及之后的调用能拿到轮次的结果。testReleaseUnitTest编译了改动后的主代码,JVM 单测全部通过。Android 侧的超时没有专门的单测,因为SyncCoordinator的轮次状态是进程级静态量,现有 JVM 测试只覆盖performAttempts。🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit