Conversation
Event uploads share the uplink with the app's own requests. Two properties of the drain loop decided how much they interfered with it, and neither was reachable from configuration: - The batch roll window was a fixed 5 s constant, so events could not be packed into fewer, better-compressed requests. - The drain loop had no bound at all: one successful upload immediately claimed the next batch, so a backlog accumulated while offline went out as a single uninterrupted burst. Add setBatchWindowMs and setMaxBatchesPerCycle to ConfigurationBuilder. These mirror Android's BatchSize and BatchProcessingLevel, as continuous values rather than enums, following setBatchUploadFrequencyMs which predates them. The per-cycle bound defaults to 10, matching BatchProcessingLevel.MEDIUM. Enforce the bound at every scheduling path, not only the timer. triggerNow() re-enters the drain directly on each force-flushed error or crash write, so a scheduler pacing only its own timer would drop the bound under exactly the load that needs it. A cycle that spends its budget records cycleYieldUntilMs, and both triggerNow() and the coalesced-retrigger path floor their delay at it. The first force-flush of a cycle with budget left is still immediate, which is what the call exists for. batchWindowMs also gates the cross-process claim guard for batches created by the deferred-upload process, so both processes must be built from the same Configuration. Noted on the field and in the README.
The Android, iOS, and Flutter SDKs all express upload pacing through the same three enums — UploadFrequency, BatchSize, BatchProcessingLevel — with identical case names and identical values. HarmonyOS was the only platform that did not, exposing a millisecond setter instead, so tuning advice written for one platform had to be translated by hand for this one. Adopt the shared vocabulary: add the three enums with the values the other SDKs use, and drop setBatchUploadFrequencyMs. Defaults now match the Android DEFAULT_CORE_CONFIG exactly (AVERAGE / MEDIUM / MEDIUM), so the same setting produces the same behaviour on every platform. This removes the range clamping the millisecond setters needed: an enum cannot carry an out-of-range value, so the checks had nothing left to guard. A test pins the enum values against the other SDKs, since silent drift there would invalidate cross-platform tuning advice without failing anything else. Also fixes the deferred-upload pipeline, which built its FilePersistenceStrategy without a batch window and so used the module fallback rather than the configured one. The cross-process claim guard is derived from that window: with the main process on a longer window, the deferred process would consider a batch claimable while the main process was still appending to it. Both pipelines now take the configured value, and the module fallback is defined as the configured default so an omitted argument cannot silently change behaviour. BREAKING CHANGE: setBatchUploadFrequencyMs is removed. Replace with setUploadFrequency(UploadFrequency.RARE) for the previous 5 s default, or drop the call to take the new AVERAGE default.
- UploadScheduler: floor every scheduling path at the retry backoff via a single scheduleAt choke point. A force-flush (an error/crash write, a manual flush, or backgrounding) can no longer cancel an in-progress backoff and retry a failing intake at the app's error rate. - Backgrounding and manual flushes waive the cycle budget: the process is about to freeze (a frozen process never fires the timer the budget would impose), or the app explicitly asked to ship now. The backoff is never waived. - flushForWork and flushAndWait default to the configured BatchProcessingLevel instead of a hard-coded 20, so the configured level bounds the deferred-upload and flush drains too. - FilePersistenceStrategy: the foreign-batch claim guard floors at the largest supported batch window, so independently configured processes can no longer claim a batch another process is still appending to. - Keep the new public enums and their setters in the obfuscation keep lists so release builds resolve them. - Document the removed setter, the migration path, and the two default changes in the changelog.
Bound upload bursts and align batching config with the other platform SDKs
Bumps the five SDK packages to 0.5.0 and records the changes shipped since 0.4.0. The minor rather than the patch position: this release removes `ConfigurationBuilder.setBatchUploadFrequencyMs` and changes two defaults that apps inherit without asking for them. A patch number would hide both from anyone who upgrades without reading the changelog. Version numbers live in three places — the oh-package manifests with their inter-package pins, Version.ets, and the test fixtures carrying the version string — and all three move together here.
release(harmony): SDK 0.5.0 — cross-platform batching configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs
publishwithmainfor the 0.5.0 release.Contents
Release note
Breaking:
ConfigurationBuilder.setBatchUploadFrequencyMsis removed. Uploadpacing now uses
UploadFrequency,BatchSizeandBatchProcessingLevel— thesame enums, case names and values as the other platform SDKs.
Two defaults changed for apps that never set them: upload cycle interval 5 s → 2 s,
batch roll window 5 s → 10 s. Both now match the other platforms.
Also fixes three delivery defects found in review: a force-flush could cancel the
intake retry backoff, the deferred-upload process could claim a batch the main
process was still appending to, and
BatchProcessingLevelwas ignored by thedeferred and
flushAndWaitdrains.After merge
Publishing is triggered by tagging the merged commit:
The workflow validates that the tag version matches
flashcat-core's packageversion (0.5.0) and that the tagged commit is contained in
publish.Verification
./scripts/ci-check.shon the merged tree — ALL CHECKS PASSED (148 tests, HARbuild, demo HAP build, ArkTS unit-test type check).