Skip to content

Optimize the pool lock to session key lock#14

Merged
vincentbergman merged 3 commits intomasterfrom
feat/optimize-pool-lock
Apr 5, 2026
Merged

Optimize the pool lock to session key lock#14
vincentbergman merged 3 commits intomasterfrom
feat/optimize-pool-lock

Conversation

@AlexYangYu
Copy link
Copy Markdown
Collaborator

Replace global _pool_lock with per-key locks to eliminate session
creation bottlenecks. Now concurrent requests for different devices
execute fully in parallel; only same-key requests are serialized to
prevent duplicate SSH connections.

Alex Yang added 3 commits April 2, 2026 08:49
Replace global _pool_lock with per-key locks to eliminate session
creation bottlenecks. Now concurrent requests for different devices
execute fully in parallel; only same-key requests are serialized to
prevent duplicate SSH connections.

Changes:
- Use _key_locks dict for per-session-key locking
- Add double-check pattern after acquiring key lock
- Add _cleanup_key_lock to prevent lock accumulation
- Improve logging (debug vs info levels)
- Add pyright/basedpyright config to pyproject.toml
- Minor formatting and CLI improvements
@vincentbergman vincentbergman merged commit 96161d0 into master Apr 5, 2026
4 checks passed
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.

2 participants