Skip to content

Commit eba0398

Browse files
authored
Revert "Add check if an operation was cancelled" (#1339)
This reverts commit 6ae2ab2 and c0c6445 Relates-To: OLPEDGE-2746 Signed-off-by: Yevhenii Dudnyk <[email protected]>
1 parent 860a2c3 commit eba0398

File tree

3 files changed

+7
-73
lines changed

3 files changed

+7
-73
lines changed

olp-cpp-sdk-dataservice-read/src/DownloadItemsJob.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,6 @@ class DownloadItemsJob {
8484
if (response.IsSuccessful()) {
8585
requests_succeeded_++;
8686
} else {
87-
if (response.GetError().GetErrorCode() ==
88-
olp::client::ErrorCode::Cancelled &&
89-
user_callback_) {
90-
auto user_callback = std::move(user_callback_);
91-
if (user_callback) {
92-
user_callback(client::ApiError::Cancelled());
93-
}
94-
return;
95-
}
96-
9787
requests_failed_++;
9888
}
9989

@@ -105,7 +95,7 @@ class DownloadItemsJob {
10595
GetAccumulatedBytes(accumulated_statistics_)});
10696
}
10797

108-
if (!--download_task_count_ && user_callback_) {
98+
if (!--download_task_count_) {
10999
OLP_SDK_LOG_DEBUG_F("DownloadItemsJob",
110100
"Download complete, succeeded=%zu, failed=%zu",
111101
requests_succeeded_, requests_failed_);

olp-cpp-sdk-dataservice-read/src/QueryMetadataJob.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,18 @@ class QueryMetadataJob {
112112
}
113113
}
114114

115-
if (canceled_) {
116-
download_job_->OnPrefetchCompleted(
117-
{{client::ErrorCode::Cancelled, "Cancelled"}});
118-
return;
119-
}
120-
121115
if (!--query_count_) {
122116
if (CheckIfFail()) {
123117
download_job_->OnPrefetchCompleted(query_errors_.front());
124118
return;
125119
}
126120

121+
if (canceled_) {
122+
download_job_->OnPrefetchCompleted(
123+
{{client::ErrorCode::Cancelled, "Cancelled"}});
124+
return;
125+
}
126+
127127
if (filter_) {
128128
query_result_ = filter_(std::move(query_result_));
129129
}

tests/integration/olp-cpp-sdk-dataservice-read/VersionedLayerClientPrefetchPartitionsTest.cpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -216,62 +216,6 @@ TEST_F(VersionedLayerClientPrefetchPartitionsTest, PrefetchPartitionsFails) {
216216
}
217217
}
218218

219-
TEST_F(VersionedLayerClientPrefetchPartitionsTest, PrefetchPartitionCancelled) {
220-
auto partitions_count = 1;
221-
auto client =
222-
read::VersionedLayerClient(kCatalogHrn, kLayer, boost::none, settings_);
223-
auto partitions = GeneratePartitionIds(partitions_count);
224-
auto partitions_response =
225-
ReadDefaultResponses::GeneratePartitionsResponse(partitions_count);
226-
const auto request =
227-
read::PrefetchPartitionsRequest().WithPartitionIds(partitions);
228-
{
229-
SCOPED_TRACE("Get version fails");
230-
231-
ExpectVersionRequest(
232-
http::NetworkResponse().WithStatus(HttpStatusCode::BAD_REQUEST));
233-
234-
auto future = client.PrefetchPartitions(request).GetFuture();
235-
ASSERT_NE(future.wait_for(std::chrono::seconds(kTimeout)),
236-
std::future_status::timeout);
237-
238-
auto response = future.get();
239-
ASSERT_FALSE(response.IsSuccessful());
240-
}
241-
{
242-
SCOPED_TRACE("Query partition fails");
243-
ExpectVersionRequest();
244-
ExpectQueryPartitionsRequest(
245-
partitions, partitions_response,
246-
http::NetworkResponse().WithStatus(HttpStatusCode::BAD_REQUEST));
247-
248-
auto future = client.PrefetchPartitions(request).GetFuture();
249-
ASSERT_NE(future.wait_for(std::chrono::seconds(kTimeout)),
250-
std::future_status::timeout);
251-
252-
auto response = future.get();
253-
ASSERT_FALSE(response.IsSuccessful());
254-
}
255-
{
256-
SCOPED_TRACE("Get data cancelled");
257-
ExpectQueryPartitionsRequest(partitions, partitions_response);
258-
259-
ExpectBlobRequest(
260-
partitions_response.GetPartitions().begin()->GetDataHandle(), "data",
261-
http::NetworkResponse().WithStatus(
262-
static_cast<int>(http::ErrorCode::CANCELLED_ERROR)));
263-
264-
auto test_request = client.PrefetchPartitions(request);
265-
auto future = test_request.GetFuture();
266-
ASSERT_NE(future.wait_for(std::chrono::seconds(kTimeout)),
267-
std::future_status::timeout);
268-
269-
auto response = future.get();
270-
ASSERT_FALSE(response.IsSuccessful());
271-
ASSERT_EQ(response.GetError().GetErrorCode(), client::ErrorCode::Cancelled);
272-
}
273-
}
274-
275219
TEST_F(VersionedLayerClientPrefetchPartitionsTest, PrefetchBatchFails) {
276220
// Should result in two metadata query
277221
constexpr auto partitions_count = 200u;

0 commit comments

Comments
 (0)