File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ impl QueueProvider {
18
18
) -> EResult < Arc < Mutex < QueueProvider > > > {
19
19
let mut map = HashMap :: new ( ) ;
20
20
21
- for ( template_name , template) in instance_provider. get_templates ( ) . await ? {
22
- map. insert ( template_name , Queue :: new ( template) ) ;
21
+ for template in instance_provider. get_templates ( ) . await ? {
22
+ map. insert ( String :: from ( & template . name ) , Queue :: new ( template) ) ;
23
23
}
24
24
25
25
Ok ( Arc :: new ( Mutex :: new ( QueueProvider { queue_map : map } ) ) )
Original file line number Diff line number Diff line change @@ -107,15 +107,15 @@ impl InstanceProvider {
107
107
}
108
108
}
109
109
110
- pub async fn get_templates ( & self ) -> EResult < HashMap < String , Template > > {
110
+ pub async fn get_templates ( & self ) -> EResult < Vec < Template > > {
111
111
let url = self . get_template_host ( "templates" ) . await ;
112
112
113
113
debug ! ( "Fetching template list from {}" , url) ;
114
114
115
115
let request = reqwest:: get ( & url) . await ?;
116
116
117
117
if request. status ( ) . is_success ( ) {
118
- let template = request. json :: < HashMap < String , Template > > ( ) . await ?;
118
+ let template = request. json :: < Vec < Template > > ( ) . await ?;
119
119
120
120
Ok ( template)
121
121
} else {
Original file line number Diff line number Diff line change 1
- use serde_json:: { Map , Value } ;
1
+ use serde_json:: Value ;
2
+ use std:: collections:: HashMap ;
2
3
3
4
use serde:: { Deserialize , Serialize } ;
4
5
@@ -16,5 +17,5 @@ pub struct Template {
16
17
pub slots : i32 ,
17
18
pub resources : Resources ,
18
19
19
- pub labels : Map < String , Value > ,
20
+ pub labels : HashMap < String , Value > ,
20
21
}
You can’t perform that action at this time.
0 commit comments