Skip to content

Commit

Permalink
chore: dry up eos
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jan 25, 2024
1 parent 7cf88fd commit c6ccc1d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c6ccc1d

Please sign in to comment.