Repository navigation
File upload: send each batch from the latest ack - #18
Merged
Merged
Conversation
PR #17 carried on past an ack that covered only part of a batch, and took an ack arriving 700 ms or more after the last block as the device's timer ack. With current RaftCore (PR #14: the first block out of sequence is acked at once, and the acks stay in step with the batches) that rule sends blocks the device then drops without an ack after a lost block mid-batch, and waits 1 s for the timer ack each time. Each batch now starts from the latest ack again, as before PR #17, keeping its two fixes: acks arriving while a batch is going out count (they were ignored, so after a loss every later batch waited for the timer ack), and a late ack behind one already received is ignored. At most one batch is in flight, as before PR #17. Upload tests (simulated device, 200 blocks at 15 ms each, 6 lost): - current firmware, lost mid-batch: 12.9 s with 6 timer acks -> 5.4 s with none (239 blocks sent) - current firmware, lost at the start of a batch: 6.7 s -> 6.6 s (251 blocks) - older firmware: 6.0-6.2 s -> 7.0-7.4 s (367-391 blocks), against 29 s before PR #17 The tests now cover both firmware versions with blocks lost mid-batch and at the start of a batch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
PR #17 changed
RaftFileHandlerto carry on past an ack that covered only part of a batch, and to treat an ack arriving 700 ms or more after the last block as the device's timer ack.Since RaftCore PR #14, the device acks the first block out of sequence at once and keeps its acks in step with the host's batches. With that firmware the PR #17 rule goes wrong whenever a block is lost mid-batch:
Change
Each batch starts from the latest ack again, as it did before PR #17. PR #17's two fixes stay:
The timing-based timer-ack detection is removed. At most one batch is in flight, as before PR #17. PR #17 allowed two.
Effect
Upload tests: a simulated device with RaftCore's ack rules, 200 blocks at 15 ms each (BLE-like), 6 lost blocks.
With older firmware this PR is about 1 s slower than PR #17, but uses the original flow control and is still about 4× faster than before PR #17. RaftCLI's RICREST upload uses the same rule, and its own simulator gives the same block counts.
Tests
RaftFileHandler.test.tsnow covers current and older firmware, with blocks lost mid-batch and at the start of a batch, plus the last block lost and the late-ack case. It checks timer acks, blocks sent and blocks in flight.🤖 Generated with Claude Code