Skip to content

Commit

Permalink
update another test that changes with updated batching logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicbarnes committed May 19, 2023
1 parent 16e5c35 commit cb2a487
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ func (w *Writer) WriteMessages(ctx context.Context, msgs ...Message) error {
batchBytes := w.batchBytes()

for i := range msgs {
n := int64(msgs[i].size())
n := int64(msgs[i].totalSize())
if n > batchBytes {
// This error is left for backward compatibility with historical
// behavior, but it can yield O(N^2) behaviors. The expectations
Expand Down
10 changes: 5 additions & 5 deletions writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func testWriterBatchBytes(t *testing.T) {

w := newTestWriter(WriterConfig{
Topic: topic,
BatchBytes: 48,
BatchBytes: 50,
BatchTimeout: math.MaxInt32 * time.Second,
Balancer: &RoundRobin{},
})
Expand All @@ -463,10 +463,10 @@ func testWriterBatchBytes(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if err := w.WriteMessages(ctx, []Message{
{Value: []byte("M0")}, // 24 Bytes
{Value: []byte("M1")}, // 24 Bytes
{Value: []byte("M2")}, // 24 Bytes
{Value: []byte("M3")}, // 24 Bytes
{Value: []byte("M0")}, // 25 Bytes
{Value: []byte("M1")}, // 25 Bytes
{Value: []byte("M2")}, // 25 Bytes
{Value: []byte("M3")}, // 25 Bytes
}...); err != nil {
t.Error(err)
return
Expand Down

0 comments on commit cb2a487

Please sign in to comment.