1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

Update load iterator batch size

This commit is contained in:
mcrakhman 2024-08-16 12:26:26 +02:00
parent 8caf60f4fb
commit 415bf3313d
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
4 changed files with 15 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package streampool
import (
"sync/atomic"
"go.uber.org/zap"
"storj.io/drpc"
)
@ -38,6 +39,14 @@ func (st *streamStat) AddMessage(msg drpc.Message) {
func (st *streamStat) RemoveMessage(msg drpc.Message) {
if sizeable, ok := msg.(SizeableMessage); ok {
size := sizeable.Size()
// TODO: find the real problem :-)
if st.totalSize.Load() > int64(size) {
st.totalSize.Add(-int64(size))
} else {
log.Error("streamStat.RemoveMessage: totalSize is less than message size", zap.Int("size", size), zap.Int64("totalSize", st.totalSize.Load()))
st.totalSize.Store(0)
}
st.totalSize.Add(-int64(sizeable.Size()))
st.msgCount.Add(-1)
}