Skip to content

Commit 208d71b

Browse files
Add timeout in performance test and add log on timeout error
Add 1 second timeout in performance test. Add log when wait on condition is timeouted. Relates-To: OLPEDGE-1133 Signed-off-by: Diachenko Mykahilo <[email protected]>
1 parent 1e717e9 commit 208d71b

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

olp-cpp-sdk-dataservice-read/src/ApiClientLookup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ ApiClientLookup::ApiClientResponse ApiClientLookup::LookupApi(
199199

200200
if (!condition.Wait(std::chrono::seconds(settings.retry_settings.timeout))) {
201201
cancellation_context.CancelOperation();
202+
OLP_SDK_LOG_INFO_F(kLogTag, "LookupApi(%s/%s): %s - timeout",
203+
service.c_str(), service_version.c_str(),
204+
catalog.partition.c_str());
202205
return client::ApiError(client::ErrorCode::RequestTimeout,
203206
"Network request timed out.");
204207
}

olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ read::CatalogResponse CatalogRepository::GetCatalog(
217217

218218
if (!condition.Wait(std::chrono::seconds{timeout})) {
219219
cancellation_context.CancelOperation();
220+
OLP_SDK_LOG_INFO_F(kLogTag, "timeout");
220221
return ApiError(ErrorCode::RequestTimeout, "Network request timed out.");
221222
}
222223

@@ -393,6 +394,7 @@ MetadataApi::CatalogVersionResponse CatalogRepository::GetLatestVersion(
393394

394395
if (!condition.Wait(std::chrono::seconds{timeout})) {
395396
cancellation_context.CancelOperation();
397+
OLP_SDK_LOG_INFO_F(kLogTag, "timeout");
396398
return ApiError(ErrorCode::RequestTimeout, "Network request timed out.");
397399
}
398400
interest_flag->store(false);

olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ DataResponse DataRepository::GetBlobData(
461461
// We are just about exit the execution.
462462

463463
cancellation_context.CancelOperation();
464+
OLP_SDK_LOG_INFO_F(kLogTag, "timeout");
464465
return ApiError(ErrorCode::RequestTimeout, "Network request timed out.");
465466
}
466467

olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ PartitionsResponse PartitionsRepository::GetPartitions(
470470

471471
if (!condition.Wait(timeout)) {
472472
cancellation_context.CancelOperation();
473+
OLP_SDK_LOG_INFO_F(kLogTag, "timeout");
473474
return client::ApiError(client::ErrorCode::RequestTimeout,
474475
"Network request timed out.");
475476
}
@@ -577,6 +578,7 @@ QueryApi::PartitionsResponse PartitionsRepository::GetPartitionById(
577578

578579
if (!condition.Wait(timeout)) {
579580
cancellation_context.CancelOperation();
581+
OLP_SDK_LOG_INFO_F(kLogTag, "timeout");
580582
return client::ApiError(client::ErrorCode::RequestTimeout,
581583
"Network request timed out.");
582584
}

tests/performance/MemoryTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ olp::client::OlpClientSettings MemoryTest::CreateCatalogClientSettings() {
134134
client_settings.network_request_handler = s_network;
135135
client_settings.proxy_settings = GetLocalhostProxySettings();
136136
client_settings.cache = parameter.cache_factory();
137+
client_settings.retry_settings.timeout = 1;
137138

138139
return client_settings;
139140
}

0 commit comments

Comments
 (0)