Skip to content

Commit

Permalink
Add logs when buff isn't used properly
Browse files Browse the repository at this point in the history
  • Loading branch information
lil5 committed Dec 15, 2024
1 parent 4ec26bf commit 10575d4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions grpc/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ func NewApp() *App {
var tbuf *timedbuf.TimedBuf[TimedPayload]
var tbufs []*timedbuf.TimedBuf[TimedPayload]
if Config.IsBuffered {
bufWarnLog := int(float32(Config.BufferSize) * 0.8)
tbufs = make([]*timedbuf.TimedBuf[TimedPayload], Config.BufferCluster)
flushFunc := func(payloads []TimedPayload) {
transfers := []types.Transfer{}
if lenPayloads := len(payloads); lenPayloads < bufWarnLog {
slog.Warn("Flushing Buffer", "max buffer", Config.BufferSize, "buffer size collected", lenPayloads)
}
for _, payload := range payloads {
transfers = append(transfers, payload.Transfers...)
}
Expand Down

0 comments on commit 10575d4

Please sign in to comment.