Skip to content
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

Fix a nostr subscription registration bug #201

Merged
merged 4 commits into from
Dec 19, 2024
Merged

Conversation

dangershony
Copy link
Member

@dangershony dangershony commented Dec 6, 2024

Check the dictionary _eoseCalledOnSubscriptionClients before adding a subscription class

I am not sure this is the correct fix because it might mean that we are not disposing of a subscription correctly
note this error returns until I refresh the page

@@ -117,7 +117,7 @@ public bool EoseEventReceivedOnAllRelays(string subscription)
public void MonitoringEoseReceivedOnSubscription(string subscription)
{
_logger.LogInformation($"Started monitoring subscription {subscription}");
_eoseCalledOnSubscriptionClients.Add(subscription, new List<string>());
_eoseCalledOnSubscriptionClients.TryAdd(subscription, new List<string>());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add a boolean returned from the method and check it in the caller so we can identify where the duplication is from

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean a return TryAdd(... ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead I logged a warning is this good enough?
this was called from RelaySubscriptionsHandling.TryAddEoseAction

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return the boolean and we can handle it from the caller

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle how? log it at the caller instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that way we can tell where the duplication happens and why

@dangershony dangershony merged commit dc64ff0 into main Dec 19, 2024
3 checks passed
@dangershony dangershony deleted the fix-nostr-stream-bug branch December 19, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants