@@ -277,7 +277,7 @@ void TPartition::EmplaceResponse(TMessage&& message, const TActorContext& ctx) {
277277 );
278278}
279279
280- ui64 TPartition::MeteringDataSize (const TActorContext& /* ctx */ ) const {
280+ ui64 TPartition::MeteringDataSize () const {
281281 if (DataKeysBody.size () <= 1 ) {
282282 // tiny optimization - we do not meter very small queues up to 16MB
283283 return 0 ;
@@ -296,20 +296,19 @@ ui64 TPartition::ReserveSize() const {
296296 return TopicPartitionReserveSize (Config);
297297}
298298
299- ui64 TPartition::StorageSize (const TActorContext& ctx ) const {
300- return std::max<ui64>(MeteringDataSize (ctx ), ReserveSize ());
299+ ui64 TPartition::StorageSize (const TActorContext&) const {
300+ return std::max<ui64>(MeteringDataSize (), ReserveSize ());
301301}
302302
303- ui64 TPartition::UsedReserveSize (const TActorContext& ctx ) const {
304- return std::min<ui64>(MeteringDataSize (ctx ), ReserveSize ());
303+ ui64 TPartition::UsedReserveSize (const TActorContext&) const {
304+ return std::min<ui64>(MeteringDataSize (), ReserveSize ());
305305}
306306
307- ui64 TPartition::GetUsedStorage (const TActorContext& ctx) {
308- const auto now = ctx.Now ();
307+ ui64 TPartition::GetUsedStorage (const TInstant& now) {
309308 const auto duration = now - LastUsedStorageMeterTimestamp;
310309 LastUsedStorageMeterTimestamp = now;
311310
312- auto dataSize = MeteringDataSize (ctx );
311+ auto dataSize = MeteringDataSize ();
313312 auto reservedSize = ReserveSize ();
314313 ui64 size = dataSize > reservedSize ? dataSize - reservedSize : 0 ;
315314 return size * duration.MilliSeconds () / 1000 / 1_MB; // mb*seconds
@@ -338,7 +337,7 @@ void TPartition::HandleWakeup(const TActorContext& ctx) {
338337 ctx.Schedule (WAKE_TIMEOUT, new TEvents::TEvWakeup ());
339338 ctx.Send (Tablet, new TEvPQ::TEvPartitionCounters (Partition, TabletCounters));
340339
341- ui64 usedStorage = GetUsedStorage (ctx);
340+ ui64 usedStorage = GetUsedStorage (ctx. Now () );
342341 if (usedStorage > 0 ) {
343342 ctx.Send (Tablet, new TEvPQ::TEvMetering (EMeteringJson::UsedStorageV1, usedStorage));
344343 }
@@ -778,7 +777,7 @@ void TPartition::Handle(TEvPQ::TEvPartitionStatus::TPtr& ev, const TActorContext
778777
779778 result.SetReadBytesQuota (maxQuota);
780779
781- result.SetPartitionSize (MeteringDataSize (ctx ));
780+ result.SetPartitionSize (MeteringDataSize ());
782781 result.SetUsedReserveSize (UsedReserveSize (ctx));
783782
784783 result.SetLastWriteTimestampMs (WriteTimestamp.MilliSeconds ());
0 commit comments