Skip to content

fix(task-store): drop read lock before sleep; configurable broadcast cap#155

Open
SVilgelm wants to merge 3 commits into
rust-mcp-stack:mainfrom
SVilgelm:fix/task-store-lock-and-broadcast
Open

fix(task-store): drop read lock before sleep; configurable broadcast cap#155
SVilgelm wants to merge 3 commits into
rust-mcp-stack:mainfrom
SVilgelm:fix/task-store-lock-and-broadcast

Conversation

@SVilgelm

Copy link
Copy Markdown
Contributor

📌 Summary

The task polling loop held the inner RwLock read guard across tokio::time::sleep, so every create_task / store_task_result (which need the write lock) was blocked for the entire sleep — potentially several seconds. The guard is now released before sleeping. The status-change broadcast capacity (previously a hard-coded 64) is also configurable.

🔍 Related Issues

✨ Changes Made

  • Scope the read guard so it drops before the sleep .await in the polling loop.
  • Add InMemoryTaskStore::with_capacity to configure the broadcast channel capacity (new keeps the default).

The polling loop held the inner read guard across the sleep, blocking every create_task/store_task_result for the whole sleep. Scope the guard so it is released first, and make the status-change broadcast capacity configurable via with_capacity.

Assisted-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@vilgelm.com>
Copilot AI review requested due to automatic review settings June 5, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants