From bd9ef2278714d141bf8d5093625d9a3163737e1b Mon Sep 17 00:00:00 2001 From: a <a@tuxpa.in> Date: Thu, 27 Feb 2025 16:30:48 -0600 Subject: [PATCH] extra safety check --- contrib/extension/subscription/subscription.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/extension/subscription/subscription.go b/contrib/extension/subscription/subscription.go index acaef9c..4f857d9 100644 --- a/contrib/extension/subscription/subscription.go +++ b/contrib/extension/subscription/subscription.go @@ -90,6 +90,8 @@ type Notifier struct { id SubID err chan error + + sentId bool } func (n *Notifier) ID() SubID { @@ -117,7 +119,10 @@ func (n *Notifier) send(data json.RawMessage) error { // try to send the id back. this will just fail with errAlreadySent if its already been sent. // so it is safe-ish to just ignore this error // technically we should check for jsonrpc.ErrSendAlreadyCalled and then error earlier otherwise... but is that really right? - _ = n.h.Send(n.id, nil) + if n.sentId == false { + _ = n.h.Send(n.id, nil) + n.sentId = true + } err := n.h.Notify( n.namespace+ -- GitLab