diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2022-07-28 17:00:29 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2022-07-28 17:00:29 +0300 |
commit | 35eb8ec97cddf3b493568ae83f65bb4d806447fc (patch) | |
tree | 1e3de8baaf37ec6864275a1363379705afc37a46 | |
parent | 83e9c03d0fe8990de0d446eba0dc30007eed90ac (diff) | |
download | ydb-35eb8ec97cddf3b493568ae83f65bb4d806447fc.tar.gz |
Reset buffers on retry.
-rw-r--r-- | ydb/library/yql/providers/common/http_gateway/yql_http_gateway.cpp | 10 |
1 files changed, 9 insertions, 1 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 5eedf136446..1ea067cfcc2 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 @@ -143,6 +143,13 @@ public: return {}; } + + void Reset() { + Buffer.clear(); + TStringOutput(Buffer).Swap(Output); + Output.Reserve(ExpectedSize); + TStringInput(Data).Swap(Input); + } private: void Fail(const TIssue& error) final { TIssues issues{error}; @@ -167,7 +174,7 @@ private: } } - size_t Write(void* contents, size_t size, size_t nmemb) final { + size_t Write(void* contents, size_t size, size_t nmemb) final { const auto realsize = size * nmemb; Output.Write(contents, realsize); return realsize; @@ -433,6 +440,7 @@ private: if (auto buffer = std::dynamic_pointer_cast<TEasyCurlBuffer>(easy)) { if (const auto& nextRetryDelay = buffer->GetNextRetryDelay(httpResponseCode)) { + buffer->Reset(); Delayed.emplace(nextRetryDelay->ToDeadLine(), std::move(buffer)); easy.reset(); } |