Skip to content

Commit cb2a487

Browse files
committed
update another test that changes with updated batching logic
1 parent 16e5c35 commit cb2a487

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

writer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ func (w *Writer) WriteMessages(ctx context.Context, msgs ...Message) error {
621621
batchBytes := w.batchBytes()
622622

623623
for i := range msgs {
624-
n := int64(msgs[i].size())
624+
n := int64(msgs[i].totalSize())
625625
if n > batchBytes {
626626
// This error is left for backward compatibility with historical
627627
// behavior, but it can yield O(N^2) behaviors. The expectations

writer_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ func testWriterBatchBytes(t *testing.T) {
454454

455455
w := newTestWriter(WriterConfig{
456456
Topic: topic,
457-
BatchBytes: 48,
457+
BatchBytes: 50,
458458
BatchTimeout: math.MaxInt32 * time.Second,
459459
Balancer: &RoundRobin{},
460460
})
@@ -463,10 +463,10 @@ func testWriterBatchBytes(t *testing.T) {
463463
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
464464
defer cancel()
465465
if err := w.WriteMessages(ctx, []Message{
466-
{Value: []byte("M0")}, // 24 Bytes
467-
{Value: []byte("M1")}, // 24 Bytes
468-
{Value: []byte("M2")}, // 24 Bytes
469-
{Value: []byte("M3")}, // 24 Bytes
466+
{Value: []byte("M0")}, // 25 Bytes
467+
{Value: []byte("M1")}, // 25 Bytes
468+
{Value: []byte("M2")}, // 25 Bytes
469+
{Value: []byte("M3")}, // 25 Bytes
470470
}...); err != nil {
471471
t.Error(err)
472472
return

0 commit comments

Comments
 (0)