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:
parent
8caf60f4fb
commit
415bf3313d
4 changed files with 15 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue