khatru: negentropy sessions take longer to close.
This commit is contained in:
@@ -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 the message is not empty that means we'll probably have more reconciliation sessions, so store this
|
||||||
if out != "" {
|
if out != "" {
|
||||||
deb := debounce.New(time.Second * 7)
|
deb := debounce.New(time.Minute * 2)
|
||||||
negSession := &NegentropySession{
|
negSession := &NegentropySession{
|
||||||
neg: neg,
|
neg: neg,
|
||||||
postponeClose: func() {
|
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 there is more reconciliation to do, postpone this
|
||||||
if out != "" {
|
if out != "" {
|
||||||
negSession.postponeClose()
|
negSession.postponeClose() // we will close this session after 2 minutes of no activity
|
||||||
} else {
|
} else {
|
||||||
// otherwise we can just close it
|
// otherwise we can just close it
|
||||||
|
ws.WriteJSON(nip77.CloseEnvelope{SubscriptionID: env.SubscriptionID})
|
||||||
ws.negentropySessions.Delete(env.SubscriptionID)
|
ws.negentropySessions.Delete(env.SubscriptionID)
|
||||||
}
|
}
|
||||||
case *nip77.CloseEnvelope:
|
case *nip77.CloseEnvelope:
|
||||||
|
|||||||
Reference in New Issue
Block a user