khatru: negentropy sessions take longer to close.

This commit is contained in:
fiatjaf
2025-12-01 18:28:02 -03:00
parent 668d6fc956
commit b15ad71282

View File

@@ -374,7 +374,7 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
// if the message is not empty that means we'll probably have more reconciliation sessions, so store this
if out != "" {
deb := debounce.New(time.Second * 7)
deb := debounce.New(time.Minute * 2)
negSession := &NegentropySession{
neg: neg,
postponeClose: func() {
@@ -405,9 +405,10 @@ func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
// if there is more reconciliation to do, postpone this
if out != "" {
negSession.postponeClose()
negSession.postponeClose() // we will close this session after 2 minutes of no activity
} else {
// otherwise we can just close it
ws.WriteJSON(nip77.CloseEnvelope{SubscriptionID: env.SubscriptionID})
ws.negentropySessions.Delete(env.SubscriptionID)
}
case *nip77.CloseEnvelope: