Skip to content

Conversation

@NTLx
Copy link

@NTLx NTLx commented Jan 31, 2026

This PR implements a proper object pool for TTS sessions using deadpool, addressing Issue #32.

This contribution is part of the OceanBase AI Coding Event.

🚀 Improvements

  • Robust Pooling: Replaced the manual channel-based worker implementation with deadpool, a battle-tested object pooling library for Rust.
  • Concurrency: Allows dynamic management of TTS sessions instead of a fixed worker loop.
  • Simplicity: Reduced boilerplate code by leveraging deadpool's lifecycle management.

🛠 Implementation

  • Added deadpool = "0.10" to Cargo.toml.
  • Implemented TTSManager struct which implements deadpool::managed::Manager.
  • Refactored TTSSessionPool to wrap deadpool::managed::Pool<TTSManager>.
  • Updated run_loop to lease sessions from the pool using pool.get().await.

✅ AI Contribution Details

  • Analysis: Identified the existing manual worker pool pattern in tts.rs as a candidate for optimization.
  • Refactoring: Rewrote the pool implementation to use the standard deadpool pattern (Manager + Recycle).
  • Integration: Seamlessly integrated the new pool into the existing async workflow.

@L-jasmine
Copy link
Collaborator

When is an idle object destroyed?

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