Skip to content

Commit 6095318

Browse files
authored
Statistics: TWaitForFirstEvent (#8646)
1 parent 69a5707 commit 6095318

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ydb/core/statistics/ut_common/ut_common.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <ydb/core/tx/schemeshard/schemeshard.h>
77
#include <ydb/core/tx/tx_proxy/proxy.h>
88

9+
#include <ydb/core/testlib/actors/wait_events.h>
10+
911
// TODO remove SDK
1012
#include <ydb/public/sdk/cpp/client/ydb_result/result.h>
1113
#include <ydb/public/sdk/cpp/client/ydb_table/table.h>
@@ -436,13 +438,11 @@ void AnalyzeStatus(TTestActorRuntime& runtime, TActorId sender, ui64 saTabletId,
436438
}
437439

438440
void WaitForSavedStatistics(TTestActorRuntime& runtime, const TPathId& pathId) {
439-
bool eventSeen = false;
440-
auto observer = runtime.AddObserver<TEvStatistics::TEvSaveStatisticsQueryResponse>([&](auto& ev){
441-
if (ev->Get()->PathId == pathId)
442-
eventSeen = true;
441+
TWaitForFirstEvent<TEvStatistics::TEvSaveStatisticsQueryResponse> waiter(runtime, [pathId](const auto& ev){
442+
return ev->Get()->PathId == pathId;
443443
});
444444

445-
runtime.WaitFor("TEvSaveStatisticsQueryResponse", [&]{ return eventSeen; });
445+
waiter.Wait();
446446
}
447447

448448

0 commit comments

Comments
 (0)