Feat/task scheduling#94
Open
abelfx wants to merge 7 commits into
Open
Conversation
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.
This pull request adds a global write lock to the backend to ensure only one write operation (such as CLEAR, UPLOAD, COMPOSITION, etc.) is processed at a time, and updates the frontend to display a "Queued..." status when a command is waiting for the lock. It also improves event messages for more accurate UI updates and user feedback.
Backend: Write Lock Implementation and Integration
tokio::sync::Mutexin the backend, ensuring only one write operation can be processed at a time. The lock is shared via theSseStatestruct and acquired in all relevant routes before starting a write job (api/src/routes/sse.rs,api/src/lib.rs,api/src/routes/spaces.rs,api/src/scheduler.rs). - When the lock is busy, a log message ("Write queue busy, waiting for turn...") is broadcast to the frontend so the UI can indicate the queued state (api/src/scheduler.rs).Backend: Event and Broadcast Improvements
api/src/sse_utils.rs,api/src/routes/spaces.rs).Frontend: Queued State Display
frontend/src/lib/sse.ts,frontend/src/pages/clear/Clear.tsx,frontend/src/pages/clear/lib.ts,frontend/src/pages/composition/Composition.tsx,frontend/src/pages/composition/lib.ts).frontend/src/lib/sse.ts).These changes improve consistency, prevent concurrent write issues, and provide clearer feedback to users about the status of their requests.