Skip to content

Commit

Permalink
fix(core): add connect_timeout for client (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Feb 1, 2024
1 parent c24fcbd commit a32d620
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,14 @@ Common:
| `warehouse` | Warehouse name, Databend Cloud only. |
| `sslmode` | Set to `disable` if not using tls. |
| `tls_ca_file` | Custom root CA certificate path. |
| `connect_timeout` | Connect timeout in seconds |


RestAPI client:

| Arg | Description |
|---|---|
| `presigned_url_disabled` | Set to `1` to disable presigned upload to object storage, *deprecated, use `presign` instead* |
| `presigned_url_disabled` | Set to `1` to disable presigned upload to object storage, *deprecated*, use `presign` instead |
| `wait_time_secs` | Request wait time for page, default to `1` |
| `max_rows_in_buffer` | Max rows for page buffer |
| `max_rows_per_page` | Max response rows for a single page |
Expand All @@ -199,7 +200,6 @@ FlightSQL client:

| Arg | Description |
|---|---|
| `connect_timeout` | Grpc connect timeout seconds |
| `query_timeout` | Query timeout seconds |
| `tcp_nodelay` | Default to `true` |
| `tcp_keepalive` | Tcp keepalive seconds, default to `3600`, set to `0` to disable keepalive |
Expand Down
3 changes: 3 additions & 0 deletions core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub struct APIClient {
max_rows_in_buffer: Option<i64>,
max_rows_per_page: Option<i64>,

connect_timeout: Duration,
page_request_timeout: Duration,

tls_ca_file: Option<String>,
Expand Down Expand Up @@ -112,6 +113,7 @@ impl APIClient {
"max_rows_per_page" => {
client.max_rows_per_page = Some(v.parse()?);
}
"connect_timeout" => client.connect_timeout = Duration::from_secs(v.parse()?),
"page_request_timeout_secs" => {
client.page_request_timeout = {
let secs: u64 = v.parse()?;
Expand Down Expand Up @@ -596,6 +598,7 @@ impl Default for APIClient {
wait_time_secs: None,
max_rows_in_buffer: None,
max_rows_per_page: None,
connect_timeout: Duration::from_secs(10),
page_request_timeout: Duration::from_secs(30),
tls_ca_file: None,
presign: PresignMode::Auto,
Expand Down

0 comments on commit a32d620

Please sign in to comment.