-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: remove all mutexes and store in subscription struct #133
Conversation
37d948f
to
192ad37
Compare
|
||
if (!exists && !subscription.Open) { | ||
if (!subscription.Open) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious, why is this check not at the start of the method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it because it only applies for .e.g subscribing to notifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ✅
|
@@ -804,7 +792,7 @@ func (svc *Service) publishRequestEvent(ctx context.Context, subscription *Subsc | |||
"client_pubkey": clientPubkey, | |||
}).Error("Failed to publish to relay") | |||
subscription.RequestEvent.State = REQUEST_EVENT_PUBLISH_FAILED | |||
sub.Unsub() | |||
relaySubscription.Unsub() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should stopSubscription be called here? or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did that because it's directly available, but good to keep it consistent 👍 will change to stopSubscription
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK, good simplification
This removes the need of mutexes as the suibscription struct is carried everywhere, so it's best to add the
relaySubscription
to the subscription itself instead of adding those tosvc.subscriptions