mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-18 10:06:27 +01:00
Fix: pool reconnect (#200)
* fix: bump ping timeout for poor connections * fix: always close relay on ping failure * fix: add multiple ping attempts before closing relay connection * fix: only 3 ping attempts * fix: pool check for relay context done * fix: include relay URL in debug log * fix: do not return after closing relay on max ping attempts * fix: compile error
This commit is contained in:
@@ -59,7 +59,7 @@ func (c *Connection) Close() error {
|
||||
|
||||
// Ping sends a ping message to the websocket connection.
|
||||
func (c *Connection) Ping(ctx context.Context) error {
|
||||
ctx, cancel := context.WithTimeoutCause(ctx, time.Millisecond*800, errors.New("ping took too long"))
|
||||
ctx, cancel := context.WithTimeoutCause(ctx, time.Millisecond*10000, errors.New("ping took too long"))
|
||||
defer cancel()
|
||||
return c.conn.Ping(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user