@@ -1525,7 +1525,7 @@ bool TReadSessionActor::ProcessAnswer(const TActorContext& ctx, TFormedReadRespo
1525
1525
1526
1526
Y_ABORT_UNLESS (formedResponse->RequestsInfly == 0 );
1527
1527
i64 diff = formedResponse->Response .ByteSize ();
1528
- const bool hasMessages = RemoveEmptyMessages (* formedResponse->Response .MutableBatchedData ());
1528
+ const bool hasMessages = HasMessages ( formedResponse->Response .GetBatchedData ());
1529
1529
if (hasMessages) {
1530
1530
LOG_DEBUG_S (ctx, NKikimrServices::PQ_READ_PROXY, PQ_LOG_PREFIX << " assign read id " << ReadIdToResponse << " to read request " << formedResponse->Guid );
1531
1531
formedResponse->Response .MutableBatchedData ()->SetCookie (ReadIdToResponse);
@@ -1758,26 +1758,15 @@ void TReadSessionActor::HandleWakeup(const TActorContext& ctx) {
1758
1758
}
1759
1759
}
1760
1760
1761
- bool TReadSessionActor::RemoveEmptyMessages (TReadResponse::TBatchedData& data) {
1762
- bool hasNonEmptyMessages = false ;
1763
- auto isMessageEmpty = [&](TReadResponse::TBatchedData::TMessageData& message) -> bool {
1764
- if (message.GetData ().empty ()) {
1765
- return true ;
1766
- } else {
1767
- hasNonEmptyMessages = true ;
1768
- return false ;
1761
+ bool TReadSessionActor::HasMessages (const TReadResponse::TBatchedData& data) {
1762
+ for (const auto & partData : data.GetPartitionData ()) {
1763
+ for (const auto & batch : partData.GetBatch ()) {
1764
+ if (batch.MessageDataSize () > 0 ) {
1765
+ return true ;
1766
+ }
1769
1767
}
1770
- };
1771
- auto batchRemover = [&](TReadResponse::TBatchedData::TBatch& batch) -> bool {
1772
- NProtoBuf::RemoveRepeatedFieldItemIf (batch.MutableMessageData (), isMessageEmpty);
1773
- return batch.MessageDataSize () == 0 ;
1774
- };
1775
- auto partitionDataRemover = [&](TReadResponse::TBatchedData::TPartitionData& partition) -> bool {
1776
- NProtoBuf::RemoveRepeatedFieldItemIf (partition.MutableBatch (), batchRemover);
1777
- return partition.BatchSize () == 0 ;
1778
- };
1779
- NProtoBuf::RemoveRepeatedFieldItemIf (data.MutablePartitionData (), partitionDataRemover);
1780
- return hasNonEmptyMessages;
1768
+ }
1769
+ return false ;
1781
1770
}
1782
1771
1783
1772
0 commit comments