Fix/autosave background write#32700
Open
CubikingChill wants to merge 1 commit intomusescore:masterfrom
Open
Conversation
0534f37 to
857263f
Compare
| QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther); | ||
| LOGD() << "Autosave: background write complete: " << targetContainerPathCopy; | ||
| }); | ||
| return make_ret(Ret::Code::Ok); |
Contributor
There was a problem hiding this comment.
The idea is very interesting.
But it's confusing that we have duplicate logic for both MUSE_THREADS_SUPPORT and non-MUSE_THREADS_SUPPORT, and it's currently written in a way that could be different.
How can we do this better?
Contributor
Author
There was a problem hiding this comment.
Changed. Let me know your opinion please.
0b12ad5 to
971f1e8
Compare
971f1e8 to
ae52e5d
Compare
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.
Resolves: #31596 (Maybe)
Move autosave file I/O to background thread to reduce UI stutter
Problem
Autosave runs entirely on the main thread via a
QTimer. The file I/O steps —writeFile,copy, andremove— are blocking operations that stutter the UI mid-editing, which is disruptive to workflow.Solution
After serialization completes on the main thread (unchanged), move the file I/O steps to a background thread using
Concurrent::runwhenMUSE_THREADS_SUPPORTis available.The serialization itself stays on the main thread because:
Buffer, not diskWhen threads are not supported, autosave falls back to the existing synchronous behavior.
What is not changed
How to test