Skip to content

Commit

Permalink
fix: only publish and wait till eos if unpublished
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 19, 2024
1 parent c973253 commit dd8e695
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit dd8e695

Please sign in to comment.