From 72e6e735f373d80909c80fe52a42d10c18215aa2 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 15 Jul 2026 09:17:24 +0900 Subject: [PATCH] sync: close the Deltas channel on error returns too, otherwise the publisher goroutine hangs forever and the command never exits. --- sync.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sync.go b/sync.go index 33ac0a8..40e58ee 100644 --- a/sync.go +++ b/sync.go @@ -204,6 +204,9 @@ func NewThirdPartyNegentropy(peerA, peerB *RelayThirdPartyRemote, filter nostr.F } func (n *ThirdPartyNegentropy) Run(ctx context.Context) error { + // always close Deltas so the consumer goroutine doesn't hang when we return an error + defer close(n.Deltas) + peerAIds := make(map[nostr.ID]struct{}) peerBIds := make(map[nostr.ID]struct{}) peerASkippedBounds := make(map[boundKey]struct{}) @@ -341,7 +344,6 @@ func (n *ThirdPartyNegentropy) Run(ctx context.Context) error { n.PeerA.SendClose() n.PeerB.SendClose() - close(n.Deltas) return nil }