fix: adding reconnect when deadline met
This commit is contained in:
@@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
pingPeriod = 10 * time.Second
|
pingPeriod = 10 * time.Second
|
||||||
readDeadline = 10 * time.Second
|
readDeadline = 30 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
type SafeMap[K comparable, V any] struct {
|
type SafeMap[K comparable, V any] struct {
|
||||||
@@ -300,6 +300,7 @@ func (wsClient *SafeWebsocketClient) connect() error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := conn.SetReadDeadline(time.Now().Add(readDeadline)); err != nil {
|
if err := conn.SetReadDeadline(time.Now().Add(readDeadline)); err != nil {
|
||||||
|
wsClient.triggerReconnect()
|
||||||
fmt.Printf("error on read deadline: %v\n", err)
|
fmt.Printf("error on read deadline: %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user