suharev7 / clickhouse-rs

Asynchronous ClickHouse client library for Rust programming language.
MIT License
322 stars 119 forks source link

Is the clickhouse-rs client thread safe? #179

Open monadbobo opened 2 years ago

monadbobo commented 2 years ago

For example if I use the same pool object in multiple tokio tasks will there be undefined behavior.

Or should I share the connection through Arc in different tasks, or should each task call pool.clone() to share the connection。

suharev7 commented 2 years ago

Yes, it's thread safe. 'pool.clone()' and sharing the connection through Arc will both work correctly.