File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -1585,7 +1585,10 @@ impl Connection {
15851585 /// that are stored in it. Unassigned deployments are ignored; in
15861586 /// particular, that ignores deployments that are going to be removed
15871587 /// soon.
1588- pub fn least_used_shard ( & mut self , shards : & [ Shard ] ) -> Result < Option < Shard > , StoreError > {
1588+ pub async fn least_used_shard (
1589+ & mut self ,
1590+ shards : & [ Shard ] ,
1591+ ) -> Result < Option < Shard > , StoreError > {
15891592 use deployment_schemas as ds;
15901593 use subgraph_deployment_assignment as a;
15911594
Original file line number Diff line number Diff line change @@ -666,15 +666,15 @@ impl Inner {
666666 }
667667 }
668668
669- fn place_in_shard ( & self , mut shards : Vec < Shard > ) -> Result < Shard , StoreError > {
669+ async fn place_in_shard ( & self , mut shards : Vec < Shard > ) -> Result < Shard , StoreError > {
670670 match shards. len ( ) {
671671 0 => Ok ( PRIMARY_SHARD . clone ( ) ) ,
672672 1 => Ok ( shards. pop ( ) . unwrap ( ) ) ,
673673 _ => {
674674 let mut conn = self . primary_conn ( ) ?;
675675
676676 // unwrap is fine since shards is not empty
677- let shard = conn. least_used_shard ( & shards) ?. unwrap ( ) ;
677+ let shard = conn. least_used_shard ( & shards) . await ?. unwrap ( ) ;
678678 Ok ( shard)
679679 }
680680 }
@@ -700,7 +700,7 @@ impl Inner {
700700 None => Ok ( ( PRIMARY_SHARD . clone ( ) , default_node) ) ,
701701 Some ( ( shards, nodes) ) => {
702702 let node = self . place_on_node ( nodes, default_node) . await ?;
703- let shard = self . place_in_shard ( shards) ?;
703+ let shard = self . place_in_shard ( shards) . await ?;
704704
705705 Ok ( ( shard, node) )
706706 }
You can’t perform that action at this time.
0 commit comments