-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat!: add disconnectTimeout
option to rx-nostr config
#165
Conversation
packages/core/src/config/config.ts
Outdated
|
||
/** | ||
* How long a relay connection should be held open when no longer used | ||
* @default 0 |
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.
Nice annotation👍. I will introduce this in other doc comments.
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.
Do you think it makes sense to add a default timeout of 10000
( 10s )?
Currently rx-nostr makes a lot of connections to temporary relays or even the default ones when its set to lazy
and its much smoother if it keeps the connections open for a while
I wanted to ask first since its maybe a breaking change
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.
As you mention, it is a breaking change but certainly makes sense. In my personal opinion I find it acceptable to include it in this minor update. Let's change it to 10000
.
It will break some test cases so please set disconnectTimeout: 0
to fix them.
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.
@hzrd149 Do you change the default value in this PR? If not, I will merge soon.
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.
added a default of 10000 (10s) and updated the tests
packages/core/src/config/config.ts
Outdated
@@ -48,6 +49,13 @@ export interface RxNostrConfig { | |||
* Auto reconnection strategy. | |||
*/ | |||
retry?: RetryConfig; | |||
|
|||
/** | |||
* How long a relay connection should be held open when no longer used |
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.
I think we should explain that it only affect lazy strategy relays and default relays.
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.
updated
@hzrd149 I think the implementation is very simple and great! Could you update the doc comment to show what relays the option affects? |
disconnectTimeout
option to rx-nostr config
disconnectTimeout
option to rx-nostr configdisconnectTimeout
option to rx-nostr config
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.
Thank you!
This is my best attempt at adding a disconnect timeout option to rx-nostr to address #164
Let me know if you think there is a better way to implement this but I think I made it pretty simple :)