Skip to content

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

Open
SVilgelm wants to merge 1 commit 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 1 commit 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>
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.

1 participant