Skip to content

Fix timeout to default to 30 seconds instead of 30000 seconds #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions extension/httpfs/httpfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ unique_ptr<duckdb_httplib_openssl::Client> HTTPFileSystem::GetClient(const HTTPP
client->set_ca_cert_path(http_params.ca_cert_file.c_str());
}
client->enable_server_certificate_verification(http_params.enable_server_cert_verification);
client->set_write_timeout(http_params.timeout);
client->set_read_timeout(http_params.timeout);
client->set_connection_timeout(http_params.timeout);
client->set_write_timeout(http_params.timeout, http_params.timeout_usec);
client->set_read_timeout(http_params.timeout, http_params.timeout_usec);
client->set_connection_timeout(http_params.timeout, http_params.timeout_usec);
client->set_decompress(false);
if (hfh && hfh->http_logger) {
client->set_logger(
Expand Down
4 changes: 2 additions & 2 deletions extension/httpfs/httpfs_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ static void LoadInternal(DatabaseInstance &instance) {

// Global HTTP config
// Single timeout value is used for all 4 types of timeouts, we could split it into 4 if users need that
config.AddExtensionOption("http_timeout", "HTTP timeout read/write/connection/retry", LogicalType::UBIGINT,
Value(30000));
config.AddExtensionOption("http_timeout", "HTTP timeout read/write/connection/retry (in seconds)", LogicalType::UBIGINT,
Value::UBIGINT(HTTPParams::DEFAULT_TIMEOUT_SECONDS));
config.AddExtensionOption("http_retries", "HTTP retries on I/O error", LogicalType::UBIGINT, Value(3));
config.AddExtensionOption("http_retry_wait_ms", "Time between retries", LogicalType::UBIGINT, Value(100));
config.AddExtensionOption("force_download", "Forces upfront download of file", LogicalType::BOOLEAN, Value(false));
Expand Down
5 changes: 3 additions & 2 deletions extension/httpfs/include/httpfs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct ResponseWrapper {

struct HTTPParams {

static constexpr uint64_t DEFAULT_TIMEOUT = 30000; // 30 sec
static constexpr uint64_t DEFAULT_TIMEOUT_SECONDS = 30; // 30 sec
static constexpr uint64_t DEFAULT_RETRIES = 3;
static constexpr uint64_t DEFAULT_RETRY_WAIT_MS = 100;
static constexpr float DEFAULT_RETRY_BACKOFF = 4;
Expand All @@ -46,7 +46,8 @@ struct HTTPParams {
static constexpr bool DEFAULT_ENABLE_SERVER_CERT_VERIFICATION = false;
static constexpr uint64_t DEFAULT_HF_MAX_PER_PAGE = 0;

uint64_t timeout = DEFAULT_TIMEOUT;
uint64_t timeout = DEFAULT_TIMEOUT_SECONDS; // seconds component of a timeout
uint64_t timeout_usec = 0; // usec component of a timeout
uint64_t retries = DEFAULT_RETRIES;
uint64_t retry_wait_ms = DEFAULT_RETRY_WAIT_MS;
float retry_backoff = DEFAULT_RETRY_BACKOFF;
Expand Down
Loading