Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kafka/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (e Error) IsRetriable() bool {
// IsTimeout returns true if the error is a timeout error.
// A timeout error indicates that the operation timed out locally.
func (e Error) IsTimeout() bool {
return e.code == ErrTimedOut || e.code == ErrTimedOutQueue
return e.code == ErrTimedOut || e.code == ErrTimedOutQueue || e.code == ErrMsgTimedOut
}

// TxnRequiresAbort returns true if the error is an abortable transaction error
Expand Down
9 changes: 9 additions & 0 deletions kafka/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ func TestFatalError(t *testing.T) {
t.Logf("%v", normalErr)
}

// TestIsTimeoutError tests timeout errors
func TestIsTimeoutError(t *testing.T) {
err := newErrorFromString(ErrMsgTimedOut, "Testing timeout error")
if !err.IsTimeout() {
t.Errorf("Expected IsTimeout() to return true for %v", err)
}
t.Logf("%v", err)
}

// TestFatalErrorClient tests fatal errors using a client instance
func TestFatalErrorClient(t *testing.T) {
p, err := NewProducer(&ConfigMap{})
Expand Down