-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add latency
to RelayConnectionStats
#117
Conversation
Instead of one thread per relay, maybe it would be better to have one global thread (of the pool?) that checks the latency on all active relays at that moment? User could add / remove relays, some could go offline or become unresponsive, yet the thread could still query and measure every minute. |
The problem is that if there is a connected relay that is unresponsive, that will block the loop. I can set a timeout for I don't think there are problems if we use another thread per relay. The RAM will increase if some relays are disconnected since the messages/events will be stored in a channel (max 1024), but in general should be very low. A problem with this implementation could be that the dev will receive events that not requested in |
No, I didn't see any performance impact of 1 extra thread per relay. I was only wondering if it can be further optimized, but as you said, an unresponsive relay could complicate things if one thread is checking all relays. So then I agree, 1 thread per relay is probably the best approach.
Very good point. Then I suppose the NIP-11 Relay Info Document is the least intrusive, since the reply doesn't come as an event? In that case, the latency check would belong behind the |
5611276
to
b27b51b
Compare
Thanks! |
I found an alternative way to ping relays, but unfortunately is not supported on WASM (so no latency stat for WASM). |
No description provided.