Repository navigation
Send bundle chunks from the file, and test against several Chorus clients - #31
Merged
Merged
Conversation
pullBundleChunk read each chunk into a byte array and then wrote that array as the response, so a slow client pinned the whole chunk in server memory for as long as its download took. Now the response carries the file region (path, offset, count) and RestDispatcher sends it with SendFileAsync, which uses sendfile where the platform has it and never holds the chunk in managed memory. Headers, Content-Length and the wire format are unchanged, so existing clients are unaffected; clients that ask for the rest of the bundle in one request no longer cost the server that much memory per download. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLSihB4ffNi95ioJQEvsLr
The integration tests drove one hard-coded LibChorus. They now take -p:ChorusClient=pinned|latest|hg3, and CI runs each one as a matrix leg against the same image: - pinned: LibChorus 6.0.0-beta0064 with Mercurial 6, the last release before the resumable transport moved from HttpWebRequest to HttpClient (sillsdev/chorus#399). The default, and the only leg that runs the HTTP-level tests too. - latest: the newest LibChorus, Mercurial and SIL.Core on NuGet. - hg3: LibChorus 6.0.0-beta0041 with Mercurial 3.0.3.11, as LexBox tested. That Chorus drops the port from the repo URL (fixed in sillsdev/chorus#343), so ServerFixture gains HGRESUME_HOST_PORT and this leg publishes the server on port 80. Its Linux hg needs python2. Each client gets its own hg drop and output dir, so switching between them locally never mixes Mercurial files. CI now builds the image once, hands it to the test legs as an artifact, and pushes only after every leg passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chorus only looks for Mercurial/ in the test assembly's dir and the two above it. On Linux the tests had been finding the hg drop in the project dir, three levels above bin/Debug/net10.0. With the per-client output dir and hg drop dir that no longer lines up, so copy Mercurial/ into the output dir on Linux too, as on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 4 tasks
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.
AI summary
Send bundle chunks from the file
pullBundleChunkused to read each chunk into abyte[]and write that array as the response. A slow client kept the whole chunk in server memory until it finished downloading.Now the response carries a file region (path, offset, count), and
RestDispatchersends it withHttpResponse.SendFileAsync. That uses sendfile where the platform supports it, so the chunk never sits in managed memory.HgResumeResponsegainsBodyFile(aFileRegionrecord), used in place ofContent.HgResumeApi.GetChunkAsyncis replaced byGetChunkRegion, which only works out the region (the smaller ofchunkSizeand the bytes pastoffset, or empty).Content-Lengthand the wire format don't change.Content-Lengthis still set explicitly, which the Chorus client needs.Test against several Chorus clients
The integration tests take
-p:ChorusClient=pinned|latest|hg3, and CI runs each one as a matrix leg against the same image.pinned(default)latest*-*)hg3ServerFixturegainsHGRESUME_HOST_PORT, and the hg3 leg publishes the server on port 80. Its Linux hg is a python2 script, so that leg installs Python 2.7 the same way LexBox does.obj/hg/<client>) and output dir (bin/<config>/<client>), so switching clients locally never mixes Mercurial files. The two.gitignoreentries for the old drop location are gone.LexBox's own hg 3 leg had silently been testing Mercurial 6 since it moved to central package management. That's fixed separately in sillsdev/languageforge-lexbox#2793.
Test plan
dotnet buildpassesHgResume.Api.Testspass (15/15)pinned(52/52) andlatest(52/52)hg3leg passes in CI (4/4; not run locally because port 80 is taken by a local kind cluster)🤖 Generated with Claude Code