diff options
author | abcdef <akotov@ydb.tech> | 2023-09-25 14:18:22 +0300 |
---|---|---|
committer | abcdef <akotov@ydb.tech> | 2023-09-25 15:53:25 +0300 |
commit | d8146e1c0d46dc8b05b2c872400c594c7b6f5b77 (patch) | |
tree | 5ad9711a113cabc4e3467cad44407c50dd60be24 | |
parent | 00e7896952fb6bdcbddafef83dbb487b4c6c57bb (diff) | |
download | ydb-d8146e1c0d46dc8b05b2c872400c594c7b6f5b77.tar.gz |
current time on each iteration
текущее время на каждой итерации
-rw-r--r-- | ydb/public/lib/ydb_cli/commands/topic_workload/topic_workload_reader.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/topic_workload/topic_workload_reader.cpp b/ydb/public/lib/ydb_cli/commands/topic_workload/topic_workload_reader.cpp index 2c9620ffb1..aeca9f0004 100644 --- a/ydb/public/lib/ydb_cli/commands/topic_workload/topic_workload_reader.cpp +++ b/ydb/public/lib/ydb_cli/commands/topic_workload/topic_workload_reader.cpp @@ -59,20 +59,22 @@ void TTopicWorkloadReader::ReaderLoop(TTopicWorkloadReaderParams& params, TInsta TVector<NYdb::NTopic::TReadSessionEvent::TStopPartitionSessionEvent> stopPartitionSessionEvents; while (Now() < endTime && !*params.ErrorFlag) { - TInstant st = TInstant::Now(); - if (TInstant::Now() - LastPartitionStatusRequestTime > TDuration::Seconds(1)) { + auto now = TInstant::Now(); + if (now - LastPartitionStatusRequestTime > TDuration::Seconds(1)) { for (auto& st : streamState) { if (st.second.Stream) { st.second.Stream->RequestStatus(); } } - LastPartitionStatusRequestTime = st; + LastPartitionStatusRequestTime = now; } readSession->WaitEvent().Wait(TDuration::Seconds(1)); TVector<NYdb::NTopic::TReadSessionEvent::TEvent> events = GetEvents(*readSession, params, txSupport); - auto now = TInstant::Now(); + // we could wait for the event for almost one second, so we need to update the value of the variable + now = TInstant::Now(); + for (auto& event : events) { if (auto* dataEvent = std::get_if<NYdb::NTopic::TReadSessionEvent::TDataReceivedEvent>(&event)) { WRITE_LOG(params.Log, ELogPriority::TLOG_DEBUG, TStringBuilder() << dataEvent->DebugString()); |