From dd8e6951436a8101c8bb33182f291e216da68a77 Mon Sep 17 00:00:00 2001 From: im-adithya Date: Fri, 20 Dec 2024 02:17:56 +0530 Subject: [PATCH] fix: only publish and wait till eos if unpublished --- internal/nostr/nostr.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/nostr/nostr.go b/internal/nostr/nostr.go index a7eed77..48b68ff 100644 --- a/internal/nostr/nostr.go +++ b/internal/nostr/nostr.go @@ -865,14 +865,15 @@ func (svc *Service) processEvents(ctx context.Context, subscription *Subscriptio svc.subscriptionsMutex.Unlock() go func(){ - // block till EOS is received - <-sub.EndOfStoredEvents - svc.Logger.WithFields(logrus.Fields{ - "subscription_id": subscription.ID, - "relay_url": subscription.RelayUrl, - }).Debug("Received EOS") + // block till EOS is received for nip 47 handlers + // only if request event is not yet published + if (onReceiveEOS != nil && subscription.RequestEvent.State != REQUEST_EVENT_PUBLISH_CONFIRMED) { + <-sub.EndOfStoredEvents + svc.Logger.WithFields(logrus.Fields{ + "subscription_id": subscription.ID, + "relay_url": subscription.RelayUrl, + }).Debug("Received EOS") - if (onReceiveEOS != nil) { onReceiveEOS(ctx, subscription) }