aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorazevaykin <145343289+azevaykin@users.noreply.github.com>2024-09-03 12:42:49 +0300
committerGitHub <noreply@github.com>2024-09-03 12:42:49 +0300
commit60953185ece46dde08bc9d06c353a6e7238506e5 (patch)
tree0b4f1b75e9fa3d6b5b1d49e3c045d92bf6500d56
parent69a57074e4c259aea0bbb9a735c5ed821743629c (diff)
downloadydb-60953185ece46dde08bc9d06c353a6e7238506e5.tar.gz
Statistics: TWaitForFirstEvent (#8646)
-rw-r--r--ydb/core/statistics/ut_common/ut_common.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/ydb/core/statistics/ut_common/ut_common.cpp b/ydb/core/statistics/ut_common/ut_common.cpp
index 72d1b726d2..b00c70c4bd 100644
--- a/ydb/core/statistics/ut_common/ut_common.cpp
+++ b/ydb/core/statistics/ut_common/ut_common.cpp
@@ -6,6 +6,8 @@
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
+#include <ydb/core/testlib/actors/wait_events.h>
+
// TODO remove SDK
#include <ydb/public/sdk/cpp/client/ydb_result/result.h>
#include <ydb/public/sdk/cpp/client/ydb_table/table.h>
@@ -436,13 +438,11 @@ void AnalyzeStatus(TTestActorRuntime& runtime, TActorId sender, ui64 saTabletId,
}
void WaitForSavedStatistics(TTestActorRuntime& runtime, const TPathId& pathId) {
- bool eventSeen = false;
- auto observer = runtime.AddObserver<TEvStatistics::TEvSaveStatisticsQueryResponse>([&](auto& ev){
- if (ev->Get()->PathId == pathId)
- eventSeen = true;
+ TWaitForFirstEvent<TEvStatistics::TEvSaveStatisticsQueryResponse> waiter(runtime, [pathId](const auto& ev){
+ return ev->Get()->PathId == pathId;
});
- runtime.WaitFor("TEvSaveStatisticsQueryResponse", [&]{ return eventSeen; });
+ waiter.Wait();
}