@@ -28,7 +28,7 @@ pub async fn list(ctx: ApiCtx, _path: ListPath, query: ListQuery) -> Result<List
2828 ]
2929 . concat ( ) ;
3030
31- let runner_configs = if !runner_names. is_empty ( ) {
31+ let ( runner_configs, cursor ) = if !runner_names. is_empty ( ) {
3232 let runner_configs = ctx
3333 . op ( pegboard:: ops:: runner_config:: get:: Input {
3434 runners : runner_names
@@ -42,7 +42,7 @@ pub async fn list(ctx: ApiCtx, _path: ListPath, query: ListQuery) -> Result<List
4242 (
4343 runner_configs
4444 . into_iter ( )
45- . map ( |c| ( c. name , c. config ) )
45+ . map ( |c| ( c. name , c. config , c . protocol_version ) )
4646 . collect :: < Vec < _ > > ( ) ,
4747 None ,
4848 )
@@ -76,48 +76,49 @@ pub async fn list(ctx: ApiCtx, _path: ListPath, query: ListQuery) -> Result<List
7676
7777 let cursor = runner_configs
7878 . last ( )
79- . map ( |( name , config ) | format ! ( "{}:{}" , runner_config_variant( & config) , name) ) ;
79+ . map ( |c | format ! ( "{}:{}" , runner_config_variant( & c . config) , c . name) ) ;
8080
81- ( runner_configs, cursor)
81+ (
82+ runner_configs
83+ . into_iter ( )
84+ . map ( |c| ( c. name , c. config , c. protocol_version ) )
85+ . collect :: < Vec < _ > > ( ) ,
86+ cursor,
87+ )
8288 } ;
8389
8490 // Fetch pool errors
85- let runner_pool_errors: HashMap < String , _ > = if !runner_configs. 0 . is_empty ( ) {
91+ let runner_pool_errors = if !runner_configs. is_empty ( ) {
8692 let runners = runner_configs
87- . 0
8893 . iter ( )
89- . map ( |( name, _) | ( namespace. namespace_id , name. clone ( ) ) )
94+ . map ( |( name, _, _ ) | ( namespace. namespace_id , name. clone ( ) ) )
9095 . collect ( ) ;
9196 ctx. op ( pegboard:: ops:: runner_config:: get_error:: Input { runners } )
9297 . await ?
9398 . into_iter ( )
9499 . map ( |e| ( e. runner_name , e. error ) )
95- . collect ( )
100+ . collect :: < HashMap < _ , _ > > ( )
96101 } else {
97102 HashMap :: new ( )
98103 } ;
99104
100- // Build response with pool errors
101- let runner_configs_with_errors: HashMap < String , RunnerConfigResponse > = runner_configs
102- . 0
103- . into_iter ( )
104- . map ( |( name, config) | {
105- let runner_pool_error = runner_pool_errors. get ( & name) . cloned ( ) ;
106- (
107- name,
108- RunnerConfigResponse {
109- config,
110- runner_pool_error,
111- } ,
112- )
113- } )
114- . collect ( ) ;
115-
116105 Ok ( ListResponse {
117- runner_configs : runner_configs_with_errors,
118- pagination : Pagination {
119- cursor : runner_configs. 1 ,
120- } ,
106+ // Build response with pool errors
107+ runner_configs : runner_configs
108+ . into_iter ( )
109+ . map ( |( name, config, protocol_version) | {
110+ let runner_pool_error = runner_pool_errors. get ( & name) . cloned ( ) ;
111+ (
112+ name,
113+ RunnerConfigResponse {
114+ config,
115+ runner_pool_error,
116+ protocol_version,
117+ } ,
118+ )
119+ } )
120+ . collect ( ) ,
121+ pagination : Pagination { cursor } ,
121122 } )
122123}
123124
0 commit comments