Skip to content

Commit

Permalink
use default client for clickhouse client
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Apr 4, 2024
1 parent caa95c5 commit afba226
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions src/connector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ gcp-bigquery-client = "0.18.0"
glob = "0.3"
google-cloud-pubsub = "0.23"
http = "0.2"
hyper = { version = "0.14", features = [
"client",
"tcp",
"http1",
"http2",
] } # required by clickhouse client
hyper-tls = "0.5"
icelake = { workspace = true }
indexmap = { version = "1.9.3", features = ["serde"] }
itertools = "0.12"
Expand Down
13 changes: 2 additions & 11 deletions src/connector/src/sink/clickhouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use core::fmt::Debug;
use std::collections::{HashMap, HashSet};
use std::time::Duration;

use anyhow::anyhow;
use clickhouse::insert::Insert;
Expand Down Expand Up @@ -190,18 +190,9 @@ impl ClickHouseEngine {
}
}

const POOL_IDLE_TIMEOUT: Duration = Duration::from_secs(5);

impl ClickHouseCommon {
pub(crate) fn build_client(&self) -> ConnectorResult<ClickHouseClient> {
use hyper_tls::HttpsConnector;

let https = HttpsConnector::new();
let client = hyper::Client::builder()
.pool_idle_timeout(POOL_IDLE_TIMEOUT)
.build::<_, hyper::Body>(https);

let client = ClickHouseClient::with_http_client(client)
let client = ClickHouseClient::default() // hyper(0.14) client inside
.with_url(&self.url)
.with_user(&self.user)
.with_password(&self.password)
Expand Down

0 comments on commit afba226

Please sign in to comment.