diff options
author | hcpp <hcpp@ydb.tech> | 2022-09-08 21:29:24 +0300 |
---|---|---|
committer | hcpp <hcpp@ydb.tech> | 2022-09-08 21:29:24 +0300 |
commit | cd6fa7264545efa04c71c5a4ea2ed2e3701a2f3d (patch) | |
tree | 7f8a6b21c52052aa88358e7163c35938e88823b8 | |
parent | 8e134b74cb33063de6ff77312871095197f77eda (diff) | |
download | ydb-cd6fa7264545efa04c71c5a4ea2ed2e3701a2f3d.tar.gz |
gateway request timeout has been added
-rw-r--r-- | ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp | 20 | ||||
-rw-r--r-- | ydb/library/yql/providers/common/proto/gateways_config.proto | 3 |
2 files changed, 21 insertions, 2 deletions
diff --git a/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp b/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp index 25994c1859b..d54197b825c 100644 --- a/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp +++ b/ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp @@ -62,6 +62,9 @@ namespace NYql { namespace { struct TCurlInitConfig { + ui64 RequestTimeout = 0; + ui64 LowSpeedTime = 0; + ui64 LowSpeedLimit = 0; ui64 ConnectionTimeout = 0; ui64 BytesPerSecondLimit = 0; ui64 BufferSize = CURL_MAX_WRITE_SIZE; @@ -120,8 +123,9 @@ public: curl_easy_setopt(Handle, CURLOPT_CONNECTTIMEOUT, Config.ConnectionTimeout); curl_easy_setopt(Handle, CURLOPT_MAX_RECV_SPEED_LARGE, Config.BytesPerSecondLimit); curl_easy_setopt(Handle, CURLOPT_BUFFERSIZE, Config.BufferSize); - curl_easy_setopt(Handle, CURLOPT_LOW_SPEED_TIME, 20L); - curl_easy_setopt(Handle, CURLOPT_LOW_SPEED_LIMIT, 1024L); + curl_easy_setopt(Handle, CURLOPT_TIMEOUT, Config.RequestTimeout); + curl_easy_setopt(Handle, CURLOPT_LOW_SPEED_TIME, Config.LowSpeedTime); + curl_easy_setopt(Handle, CURLOPT_LOW_SPEED_LIMIT, Config.LowSpeedLimit); if (!Headers.empty()) { CurlHeaders = std::accumulate(Headers.cbegin(), Headers.cend(), CurlHeaders, @@ -480,6 +484,18 @@ public: BuffersSizePerStream = httpGatewaysCfg->GetBuffersSizePerStream(); } + if (httpGatewaysCfg->HasRequestTimeoutSeconds()) { + InitConfig.RequestTimeout = httpGatewaysCfg->GetRequestTimeoutSeconds(); + } + + if (httpGatewaysCfg->HasLowSpeedTimeSeconds()) { + InitConfig.LowSpeedTime = httpGatewaysCfg->GetLowSpeedTimeSeconds(); + } + + if (httpGatewaysCfg->HasLowSpeedBytesLimit()) { + InitConfig.LowSpeedLimit = httpGatewaysCfg->GetLowSpeedBytesLimit(); + } + if (httpGatewaysCfg->HasConnectionTimeoutSeconds()) { InitConfig.ConnectionTimeout = httpGatewaysCfg->GetConnectionTimeoutSeconds(); } diff --git a/ydb/library/yql/providers/common/proto/gateways_config.proto b/ydb/library/yql/providers/common/proto/gateways_config.proto index 87405b60803..012ca620b47 100644 --- a/ydb/library/yql/providers/common/proto/gateways_config.proto +++ b/ydb/library/yql/providers/common/proto/gateways_config.proto @@ -60,6 +60,9 @@ message THttpGatewayConfig { optional uint64 ConnectionTimeoutSeconds = 4; optional uint64 BytesPerSecondLimit = 5; optional uint64 DownloadBufferBytesLimit = 6; + optional uint64 RequestTimeoutSeconds = 7; + optional uint64 LowSpeedTimeSeconds = 8; + optional uint64 LowSpeedBytesLimit = 9; } /////////////////////////////// YT /////////////////////////////// |