File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
internal/mithril-aggregator-discovery Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ serde_json = { workspace = true }
3434slog = { workspace = true }
3535slog-scope = " 4.4.0"
3636thiserror = { workspace = true }
37- tokio = { workspace = true , features = [" sync" ] }
37+ tokio = { workspace = true , features = [" sync" , " rt-multi-thread " ] }
3838
3939[dev-dependencies ]
4040mockall = { workspace = true }
Original file line number Diff line number Diff line change @@ -54,14 +54,20 @@ impl Iterator for CapableAggregatorDiscovererIterator {
5454 type Item = AggregatorEndpoint ;
5555
5656 fn next ( & mut self ) -> Option < Self :: Item > {
57- for aggregator_endpoint in & mut self . inner_iterator {
58- let aggregator_capabilities = tokio:: runtime:: Handle :: current ( )
59- . block_on ( async { aggregator_endpoint. retrieve_capabilities ( ) . await } ) ;
60- if CapableAggregatorDiscoverer :: capabilities_match (
61- & self . capabilities ,
62- & aggregator_capabilities. ok ( ) ?,
63- ) {
64- return Some ( aggregator_endpoint) ;
57+ while let Some ( aggregator_endpoint) = self . inner_iterator . next ( ) {
58+ let aggregator_endpoint_clone = aggregator_endpoint. clone ( ) ;
59+ let aggregator_capabilities = tokio:: task:: block_in_place ( move || {
60+ tokio:: runtime:: Handle :: current ( ) . block_on ( async move {
61+ aggregator_endpoint_clone. retrieve_capabilities ( ) . await
62+ } )
63+ } ) ;
64+ if let Ok ( aggregator_capabilities) = aggregator_capabilities {
65+ if CapableAggregatorDiscoverer :: capabilities_match (
66+ & self . capabilities ,
67+ & aggregator_capabilities,
68+ ) {
69+ return Some ( aggregator_endpoint) ;
70+ }
6571 }
6672 }
6773
You can’t perform that action at this time.
0 commit comments