1
0
Fork 0
forked from External/ergo

maintain lenBytes as a running count

This commit is contained in:
Shivaram Lingamneni 2020-05-14 22:16:34 -04:00
parent 2779fe7c10
commit 8efbc4bc32
3 changed files with 7 additions and 16 deletions

View file

@ -146,6 +146,7 @@ type MultilineBatch struct {
target string
responseLabel string // this is the value of the labeled-response tag sent with BATCH
message utils.SplitMessage
lenBytes int
tags map[string]string
}
@ -168,7 +169,7 @@ func (s *Session) EndMultilineBatch(label string) (batch MultilineBatch, err err
s.fakelag.Unsuspend()
// heuristics to estimate how much data they used while fakelag was suspended
fakelagBill := (batch.message.LenBytes() / 512) + 1
fakelagBill := (batch.lenBytes / 512) + 1
fakelagBillLines := (batch.message.LenLines() * 60) / 512
if fakelagBill < fakelagBillLines {
fakelagBill = fakelagBillLines