Skip to content

Commit

Permalink
Add sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna committed Nov 5, 2024
1 parent 4801a03 commit cb7d702
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions transport/split/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package split

import (
"io"
"time"
)

type splitWriter struct {
Expand Down Expand Up @@ -129,6 +130,8 @@ func (w *splitWriter) Write(data []byte) (written int, err error) {
for 0 < w.nextSplitBytes && w.nextSplitBytes < int64(len(data)) {
dataToSend := data[:w.nextSplitBytes]
n, err := w.writer.Write(dataToSend)
// Sleep to ensure bytes are properly split.
time.Sleep(100 * time.Microsecond)
written += n
w.advance(int64(n))
if err != nil {
Expand Down

0 comments on commit cb7d702

Please sign in to comment.