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 heavy loop #114

Merged
merged 2 commits into from
Dec 14, 2023
Merged

fix heavy loop #114

merged 2 commits into from
Dec 14, 2023

Conversation

mattn
Copy link
Contributor

@mattn mattn commented Dec 14, 2023

Sorry watching sub.EndOfStoredEvents in for loop make heavy loop if the chan is closed.

Copy link

sweep-ai bot commented Dec 14, 2023

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.
  • Apply: Add docstrings to all functions and file headers.

@mattn
Copy link
Contributor Author

mattn commented Dec 14, 2023

@fiatjaf I hope that this change will be merge soon because the impact of this bug is significant.

@fiatjaf fiatjaf merged commit f60b70e into nbd-wtf:master Dec 14, 2023
1 check passed
@fiatjaf
Copy link
Collaborator

fiatjaf commented Dec 14, 2023

Should we change the EndOfStoredEvents to not be closed when an EOSE is received, but instead just have something sent through it? And it's never closed?

@fiatjaf
Copy link
Collaborator

fiatjaf commented Dec 14, 2023

I don't understand the code in this function. Did I write it? Do we need this mutex? I think we don't.

@mattn
Copy link
Contributor Author

mattn commented Dec 14, 2023

Should we change the EndOfStoredEvents to not be closed when an EOSE is received, but instead just have something sent through it? And it's never closed?

Yes, it's better i thinkg since most of people should do same mistake with me.

I don't understand the code in this function. Did I write it?

No, I did.

Do we need this mutex? I think we don't.

Yes, bool is thread safe. Pleaes change if you want.

@mattn
Copy link
Contributor Author

mattn commented Dec 14, 2023

@fiatjaf Could you please put new tag?

Sorry, my bad

@fiatjaf
Copy link
Collaborator

fiatjaf commented Dec 15, 2023

No, I did.

ahahah, ok, thank you. I really thought it had been me and that I was going crazy and forgetting about my code. I'm relieved to learn it was you then.

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