Repository navigation
zdxsv replay: download on a worker thread, cancel at VM shutdown - #682
Merged
Merged
Conversation
…read, cancel at VM shutdown 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.
Description of Changes
A replay's downloads (the
.pb, the lobby's/lbs/replayanswer, a common state not yet in the cache) now run on a worker thread. When they finish, the replay start continues on the CPU thread. A VM shutdown or reset cancels them (HTTPDownloader's progress-callback cancel), joins the worker and drops the queued continuation. A broken cached common state is still downloaded again once per URL per run, now also on the worker.docs/zdxsv/replay.mdsays so.Rationale behind Changes
The downloads ran on the CPU thread, with a timeout of up to 120 s each. Until they ended, the emulator could not pause or shut down.
Suggested Testing Steps
Verified on Windows x64 (MSVC build, private rig): a replay over a slow local HTTP server (8 s per answer) played and matched its recorded trace. The VM kept running during the downloads. Closing the window during a slow download cancelled the request and exited at once. Control on the unfixed build: the shutdown waited for the HTTP request to end. Local-file replay and a re-download of a truncated cached common state: PASS. Merged with PR 669, PR 663 and PR 661: clean, builds, HTTP replay PASS.
Not run: Linux, macOS, arm64, a live (
live:) battle, a point-of-view switch. No rig script committed (the slow-server rig lives outside the repo).ReplayLoad.cppgrows past the 800-line split guideline (it was 944 lines before). Splitting out the download code is left for its own PR.Did you use AI to help find, test, or implement this issue or feature?
Yes: written and tested by Claude Code.
🤖 Generated with Claude Code