Skip to content

Commit 682b812

Browse files
committed
reconnect if failed
1 parent ebcbcaa commit 682b812

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

conn.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ func (c *Conn) loop(ctx context.Context) {
423423
for {
424424
if err := c.connect(); err != nil {
425425
// c.Close() was called
426-
return
426+
c.logger.Printf("connect failed: %s", err)
427+
time.Sleep(time.Second)
428+
continue
427429
}
428430

429431
err := c.authenticate()

0 commit comments

Comments
 (0)