io.EOF: make a retriable broker error
Sooner or later, all retriable broker errors will be stamped out.
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
+ "io"
"net"
"os"
)
@@ -39,6 +40,12 @@ func isRetriableBrokerErr(err error) bool {
if errors.As(err, &tempErr) {
return tempErr.Temporary()
}
+
+ // EOF can be returned if a broker kills a connection unexpectedly, and
+ // we can retry that.
+ if errors.Is(err, io.EOF) {
+ return true
+ }
switch err {
case errChosenBrokerDead,
errCorrelationIDMismatch:
