From 2c72bd813ef7a4a7114e3c00861dc93224676334 Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Tue, 6 Oct 2020 14:36:22 -0700 Subject: [PATCH] Default m3msg write timeouts to 5 seconds This changes both the Producer sending new messages and the Consumer sending ack messages. 5s is a safer default to prevent infinite blocking if the TCP connection is not currently available for writing (i.e the buffer is full). --- src/msg/consumer/options.go | 3 +-- src/msg/producer/writer/options.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/msg/consumer/options.go b/src/msg/consumer/options.go index ae21bd1fd7..822ffb0c95 100644 --- a/src/msg/consumer/options.go +++ b/src/msg/consumer/options.go @@ -33,8 +33,7 @@ var ( defaultAckBufferSize = 1048576 defaultAckFlushInterval = 200 * time.Millisecond defaultConnectionBufferSize = 1048576 - // TODO(ryanhall07): set this to 5s once we verify this works. - defaultWriteTimeout = 0 * time.Second + defaultWriteTimeout = 5 * time.Second ) type options struct { diff --git a/src/msg/producer/writer/options.go b/src/msg/producer/writer/options.go index 70562010bc..9c4e9d26a0 100644 --- a/src/msg/producer/writer/options.go +++ b/src/msg/producer/writer/options.go @@ -43,7 +43,7 @@ const ( defaultNumConnections = 4 defaultConnectionDialTimeout = 5 * time.Second - defaultConnectionWriteTimeout = time.Duration(0) + defaultConnectionWriteTimeout = 5 * time.Second defaultConnectionKeepAlivePeriod = 5 * time.Second defaultConnectionResetDelay = 2 * time.Second defaultConnectionFlushInterval = time.Second