Use SimplePool object in new nostr-tools for sending OTP codes to avoid relay connection closed errors#20
Merged
danieldaquino merged 2 commits intodamus-io:masterfrom May 2, 2025
Conversation
This commit changes web_auth.js to use `SimplePool` instead of direct relay objects, as recommended by the `nostr-tools` documentation, to handle relay connections more automatically and prevent issues such as errors due to the connection getting closed, or other such relay pool management responsibilities. Closes: damus-io/website#42 Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Collaborator
Author
|
@jb55, please let me know if you have any questions or suggestions, thank you. |
Collaborator
Author
|
CI tests passing, it looks failed because of this known issue: #10 |
Contributor
|
On Wed, Apr 23, 2025 at 04:39:20PM -0700, Daniel D’Aquino wrote:
This commit changes web_auth.js to use `SimplePool` instead of direct
relay objects, as recommended by the `nostr-tools` documentation, to
handle relay connections more automatically and prevent issues such as
errors due to the connection getting closed, or other such relay pool
management responsibilities.
Closes: damus-io/website#42
Signed-off-by: Daniel D’Aquino ***@***.***>
---
LGTM
|
Collaborator
Author
|
@jb55, for some reason I cannot merge this PR, the button no longer shows up for me and I can't merge via the command-line. Maybe some Github setting was changed. Can you please check? |
Contributor
|
I'll check, my bad |
Contributor
|
@danieldaquino you should have access now |
Collaborator
Author
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
nostr-toolspackage to give usSimplePool.SimplePoolinstead of the lower-levelRelayobject, as recommended by thenostr-toolsdocumentation.SimplePoolinstance active on the app singleton object to avoid constant reconnection to relays.This is an attempt to fix damus-io/website#42, based on the investigation done there.
This is a tentative fix based off of an analysis of the logs, the report, and the code. The issue could not be definitively reproduced on a controlled setup, so this fix cannot be guaranteed to fix the issue in question, but has a good probability of fixing it.
Testing:
api: 38b3000
website: 322171d3f9a8c92568b822c54568021495d767e2
Setup: Local frontend and backend
Steps:
.envto a separate file, then runnpm test. Ensure tests pass.PASS