Skip to content

Commit

Permalink
chore: remove pubkey field from unused logs
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Jul 31, 2024
1 parent b36a24c commit 9a5795b
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions internal/nostr/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,9 @@ func (svc *Service) stopSubscription(subscription *Subscription) error {
}

func (svc *Service) startSubscription(ctx context.Context, subscription *Subscription, onReceiveEOS OnReceiveEOSFunc, handleEvent HandleEventFunc) {
walletPubkey, clientPubkey := getPubkeys(subscription)

svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
}).Debug("Starting subscription")

filter := svc.subscriptionToFilter(subscription)
Expand All @@ -704,8 +700,6 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
svc.Logger.WithError(err).WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
}).Error("Failed get relay connection, retrying in 5s...")
time.Sleep(5 * time.Second) // sleep for 5 seconds
continue
Expand All @@ -717,8 +711,6 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
svc.Logger.WithError(err).WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
}).Error("Failed to subscribe to relay, retrying in 5s...")
time.Sleep(5 * time.Second) // sleep for 5 seconds
continue
Expand All @@ -731,8 +723,6 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
}).Debug("Started subscription")

err = svc.processEvents(ctx, subscription, onReceiveEOS, handleEvent)
Expand All @@ -742,8 +732,6 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
svc.Logger.WithError(err).WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
}).Error("Subscription stopped due to relay error, reconnecting in 5s...")
time.Sleep(5 * time.Second) // sleep for 5 seconds
continue
Expand All @@ -764,8 +752,6 @@ func (svc *Service) startSubscription(ctx context.Context, subscription *Subscri
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"relay_url": subscription.RelayUrl,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
}).Debug("Stopping subscription")
break
}
Expand Down Expand Up @@ -827,14 +813,10 @@ func (svc *Service) handleResponseEvent(event *nostr.Event, subscription *Subscr
}

func (svc *Service) handleSubscribedEvent(event *nostr.Event, subscription *Subscription) {
walletPubkey, clientPubkey := getPubkeys(subscription)

svc.Logger.WithFields(logrus.Fields{
"event_id": event.ID,
"event_kind": event.Kind,
"subscription_id": subscription.ID,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
"relay_url": subscription.RelayUrl,
}).Info("Received subscribed event")
responseEvent := ResponseEvent{
Expand All @@ -848,8 +830,6 @@ func (svc *Service) handleSubscribedEvent(event *nostr.Event, subscription *Subs
}

func (svc *Service) processEvents(ctx context.Context, subscription *Subscription, onReceiveEOS OnReceiveEOSFunc, handleEvent HandleEventFunc) error {
walletPubkey, clientPubkey := getPubkeys(subscription)

svc.subscriptionsMutex.Lock()
sub := svc.subscriptions[subscription.Uuid]
svc.subscriptionsMutex.Unlock()
Expand All @@ -859,8 +839,6 @@ func (svc *Service) processEvents(ctx context.Context, subscription *Subscriptio
<-sub.EndOfStoredEvents
svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
"relay_url": subscription.RelayUrl,
}).Debug("Received EOS")

Expand All @@ -875,8 +853,6 @@ func (svc *Service) processEvents(ctx context.Context, subscription *Subscriptio

svc.Logger.WithFields(logrus.Fields{
"subscription_id": subscription.ID,
"wallet_pubkey": walletPubkey,
"client_pubkey": clientPubkey,
"relay_url": subscription.RelayUrl,
}).Debug("Relay subscription events channel ended")
}()
Expand Down

0 comments on commit 9a5795b

Please sign in to comment.