client/network: Allow Kademlia queries to be prematurely finished #550
Labels
D1-medium
Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase.
I9-optimisation
An enhancement to provide better overall performance in terms of time-to-completion for a task.
While libp2p Kademlia allows queries to be finished early via
Kademlia::query_mut
,NetworkService
does not surface this functionality.With paritytech/substrate#7018 the authority discovery module resets the targeted authorities every 10 minutes, ignoring succeeding queries from previous iterations. Instead of ignoring the result of these queries, one should cancel the queries instead.
Possible solution
Have
NetworkService::get_value
andNetworkService::put_value
return aFuture
resolving to theQueryId
.Add new method
NetworkService::cancel_query
accepting aQueryId
.Importance
Given that the authority discovery module restricts the amount of in-flight queries to a low maximum, the amount of ignored in-flight requests from previous iterations is likely negligible. Thus this feature is a nice to have.
The text was updated successfully, but these errors were encountered: