debug log relay reconnections.

This commit is contained in:
fiatjaf
2025-02-03 10:34:43 -03:00
parent d0f53b3b7a
commit 8446557788

View File

@@ -4,7 +4,6 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"log"
"math" "math"
"net/http" "net/http"
"slices" "slices"
@@ -329,6 +328,7 @@ func (pool *SimplePool) subMany(
} }
// otherwise (if we were connected and got disconnected) keep trying to reconnect // otherwise (if we were connected and got disconnected) keep trying to reconnect
debugLogf("%s reconnecting because connection failed\n", nm)
goto reconnect goto reconnect
} }
firstConnection = false firstConnection = false
@@ -343,6 +343,7 @@ func (pool *SimplePool) subMany(
return exists return exists
}))...) }))...)
if err != nil { if err != nil {
debugLogf("%s reconnecting because subscription died\n", nm)
goto reconnect goto reconnect
} }
@@ -370,6 +371,7 @@ func (pool *SimplePool) subMany(
for i := range filters { for i := range filters {
filters[i].Since = &now filters[i].Since = &now
} }
debugLogf("%s reconnecting because sub.Events is broken\n", nm)
goto reconnect goto reconnect
} }
@@ -405,7 +407,7 @@ func (pool *SimplePool) subMany(
goto subscribe goto subscribe
} }
} else { } else {
log.Printf("CLOSED from %s: '%s'\n", nm, reason) debugLogf("CLOSED from %s: '%s'\n", nm, reason)
} }
return return
@@ -514,7 +516,7 @@ func (pool *SimplePool) subManyEoseNonOverwriteCheckDuplicate(
goto subscribe goto subscribe
} }
} }
log.Printf("CLOSED from %s: '%s'\n", nm, reason) debugLogf("CLOSED from %s: '%s'\n", nm, reason)
return return
case evt, more := <-sub.Events: case evt, more := <-sub.Events:
if !more { if !more {