diff --git a/service.go b/service.go index f6b1a27c2..183f8ba04 100644 --- a/service.go +++ b/service.go @@ -165,12 +165,12 @@ func (svc *Service) noticeHandler(notice string) { func (svc *Service) StartSubscription(ctx context.Context, sub *nostr.Subscription) error { go func() { + // block till EOS is received <-sub.EndOfStoredEvents svc.ReceivedEOS = true svc.Logger.Info("Received EOS") - }() - go func() { + // loop through incoming events for event := range sub.Events { go func(event *nostr.Event) { resp, err := svc.HandleEvent(ctx, event) @@ -255,10 +255,6 @@ func (svc *Service) StartSubscription(ctx context.Context, sub *nostr.Subscripti } func (svc *Service) HandleEvent(ctx context.Context, event *nostr.Event) (result *nostr.Event, err error) { - //don't process historical events - if !svc.ReceivedEOS { - return nil, nil - } svc.Logger.WithFields(logrus.Fields{ "eventId": event.ID, "eventKind": event.Kind,