Skip to content

Commit

Permalink
reduce idle wake-ups
Browse files Browse the repository at this point in the history
no need to trigger original goroutine if data was not enough.
  • Loading branch information
Abioy authored and Hchenn committed Sep 22, 2021
1 parent 3304c59 commit 33dd212
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion connection_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ func (c *connection) inputAck(n int) (err error) {
}
leftover := atomic.AddInt32(&c.waitReadSize, int32(-n))
err = c.inputBuffer.BookAck(n, leftover <= 0)
c.triggerRead()
if leftover <= 0 {
c.triggerRead()
}
c.onRequest()
return err
}
Expand Down

0 comments on commit 33dd212

Please sign in to comment.