Skip to content

Commit 6a35c5e

Browse files
Mytherincarlopi
authored andcommitted
Fix timeout to default to 30 seconds instead of 30000 seconds
1 parent 2bd203d commit 6a35c5e

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

extension/httpfs/httpfs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ unique_ptr<duckdb_httplib_openssl::Client> HTTPFileSystem::GetClient(const HTTPP
244244
client->set_ca_cert_path(http_params.ca_cert_file.c_str());
245245
}
246246
client->enable_server_certificate_verification(http_params.enable_server_cert_verification);
247-
client->set_write_timeout(http_params.timeout);
248-
client->set_read_timeout(http_params.timeout);
249-
client->set_connection_timeout(http_params.timeout);
247+
client->set_write_timeout(http_params.timeout, http_params.timeout_usec);
248+
client->set_read_timeout(http_params.timeout, http_params.timeout_usec);
249+
client->set_connection_timeout(http_params.timeout, http_params.timeout_usec);
250250
client->set_decompress(false);
251251
if (hfh && hfh->http_logger) {
252252
client->set_logger(

extension/httpfs/httpfs_extension.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ static void LoadInternal(DatabaseInstance &instance) {
2222

2323
// Global HTTP config
2424
// Single timeout value is used for all 4 types of timeouts, we could split it into 4 if users need that
25-
config.AddExtensionOption("http_timeout", "HTTP timeout read/write/connection/retry", LogicalType::UBIGINT,
26-
Value(30000));
25+
config.AddExtensionOption("http_timeout", "HTTP timeout read/write/connection/retry (in seconds)", LogicalType::UBIGINT,
26+
Value::UBIGINT(HTTPParams::DEFAULT_TIMEOUT_SECONDS));
2727
config.AddExtensionOption("http_retries", "HTTP retries on I/O error", LogicalType::UBIGINT, Value(3));
2828
config.AddExtensionOption("http_retry_wait_ms", "Time between retries", LogicalType::UBIGINT, Value(100));
2929
config.AddExtensionOption("force_download", "Forces upfront download of file", LogicalType::BOOLEAN, Value(false));

extension/httpfs/include/httpfs.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct ResponseWrapper {
3737

3838
struct HTTPParams {
3939

40-
static constexpr uint64_t DEFAULT_TIMEOUT = 30000; // 30 sec
40+
static constexpr uint64_t DEFAULT_TIMEOUT_SECONDS = 30; // 30 sec
4141
static constexpr uint64_t DEFAULT_RETRIES = 3;
4242
static constexpr uint64_t DEFAULT_RETRY_WAIT_MS = 100;
4343
static constexpr float DEFAULT_RETRY_BACKOFF = 4;
@@ -46,7 +46,8 @@ struct HTTPParams {
4646
static constexpr bool DEFAULT_ENABLE_SERVER_CERT_VERIFICATION = false;
4747
static constexpr uint64_t DEFAULT_HF_MAX_PER_PAGE = 0;
4848

49-
uint64_t timeout = DEFAULT_TIMEOUT;
49+
uint64_t timeout = DEFAULT_TIMEOUT_SECONDS; // seconds component of a timeout
50+
uint64_t timeout_usec = 0; // usec component of a timeout
5051
uint64_t retries = DEFAULT_RETRIES;
5152
uint64_t retry_wait_ms = DEFAULT_RETRY_WAIT_MS;
5253
float retry_backoff = DEFAULT_RETRY_BACKOFF;

0 commit comments

Comments
 (0)