Improve ergonomics on following Kad querys #3624
Replies: 4 comments 6 replies
-
I think that is not a bad idea although we haven't done something like that before. @mxinden thoughts? |
Beta Was this translation helpful? Give feedback.
-
Overall, yes, I think this is a good user experience improvements. I don't yet know how to solve the edge case where the user doesn't read from the channel. Should the |
Beta Was this translation helpful? Give feedback.
-
In asynchronous context the order of registering event listeners and emitting "query progressed" event is not guaranteed, which means loss of event(use |
Beta Was this translation helpful? Give feedback.
-
I am in favor of the proposed API but it is going to be tricky to implement. We need to poll all those channels internally and make sure the channel of one query isn't stalled by the user not reading from another channel. |
Beta Was this translation helpful? Give feedback.
-
When you try to query for a node in the DHT, you'll be given a
QueryId
and you need to listen to the events emitted by swarm to see how the query progresses. It's not hard to implement this myself, but I think we can do better. Instead of givingQueryId
, we can give a mpsc channel to track the progress of a query. I think it should be easy since we do keep a pool for all active queries.Again, it's totally fine for me or others to implement something like event listeners and it will still be a thing even not for following DHT queries, but I'm still happy to see it's made built-in.
Beta Was this translation helpful? Give feedback.
All reactions