@@ -8,11 +8,10 @@ use crate::server::auth::{auth_filter, AuthDetails};
88use crate :: server:: messages:: Message ;
99use crate :: server:: { Data , GithubData , HttpError } ;
1010use crossbeam_channel:: Sender ;
11- use http:: Response ;
12- use hyper:: Body ;
1311use std:: collections:: HashMap ;
1412use std:: sync:: { Arc , Condvar , Mutex } ;
1513use std:: time:: Instant ;
14+ use warp:: reply:: Response ;
1615use warp:: { Filter , Rejection } ;
1716
1817#[ derive( Deserialize ) ]
@@ -27,7 +26,7 @@ pub fn routes(
2726 data : Arc < Data > ,
2827 mutex : Arc < Mutex < Data > > ,
2928 github_data : Option < Arc < GithubData > > ,
30- ) -> impl Filter < Extract = ( Response < Body > , ) , Error = Rejection > + Clone {
29+ ) -> impl Filter < Extract = ( Response , ) , Error = Rejection > + Clone {
3130 let data_cloned = data. clone ( ) ;
3231 let data_filter = warp:: any ( ) . map ( move || data_cloned. clone ( ) ) ;
3332 let mutex_filter = warp:: any ( ) . map ( move || mutex. clone ( ) ) ;
@@ -100,11 +99,7 @@ pub fn routes(
10099 . unify ( )
101100}
102101
103- fn endpoint_config (
104- caps : Capabilities ,
105- data : Arc < Data > ,
106- auth : AuthDetails ,
107- ) -> Fallible < Response < Body > > {
102+ fn endpoint_config ( caps : Capabilities , data : Arc < Data > , auth : AuthDetails ) -> Fallible < Response > {
108103 data. agents . add_capabilities ( & auth. name , & caps) ?;
109104
110105 Ok ( ApiResponse :: Success {
@@ -120,7 +115,7 @@ fn endpoint_next_experiment(
120115 mutex : Arc < Mutex < Data > > ,
121116 github_data : Option < Arc < GithubData > > ,
122117 auth : AuthDetails ,
123- ) -> Fallible < Response < Body > > {
118+ ) -> Fallible < Response > {
124119 //we need to make sure that Experiment::next executes uninterrupted
125120 let data = mutex. lock ( ) . unwrap ( ) ;
126121 let next = Experiment :: next ( & data. db , & Assignee :: Agent ( auth. name ) ) ?;
@@ -181,7 +176,7 @@ fn endpoint_next_crate(
181176 experiment : String ,
182177 data : Arc < Data > ,
183178 _auth : AuthDetails ,
184- ) -> Fallible < Response < Body > > {
179+ ) -> Fallible < Response > {
185180 Ok ( ApiResponse :: Success {
186181 result : endpoint_next_crate_inner ( experiment, data) ?,
187182 }
@@ -332,7 +327,7 @@ fn endpoint_record_progress(
332327 result : ExperimentData < ProgressData > ,
333328 data : Arc < Data > ,
334329 _auth : AuthDetails ,
335- ) -> Fallible < Response < Body > > {
330+ ) -> Fallible < Response > {
336331 let start = Instant :: now ( ) ;
337332
338333 data. metrics
@@ -356,11 +351,7 @@ fn endpoint_record_progress(
356351 ret
357352}
358353
359- fn endpoint_heartbeat (
360- id : WorkerInfo ,
361- data : Arc < Data > ,
362- auth : AuthDetails ,
363- ) -> Fallible < Response < Body > > {
354+ fn endpoint_heartbeat ( id : WorkerInfo , data : Arc < Data > , auth : AuthDetails ) -> Fallible < Response > {
364355 data. agents . add_worker ( id) ;
365356 if let Some ( rev) = auth. git_revision {
366357 data. agents . set_git_revision ( & auth. name , & rev) ?;
@@ -376,7 +367,7 @@ fn endpoint_error(
376367 error : ExperimentData < HashMap < String , String > > ,
377368 mutex : Arc < Mutex < Data > > ,
378369 auth : AuthDetails ,
379- ) -> Fallible < Response < Body > > {
370+ ) -> Fallible < Response > {
380371 log:: error!(
381372 "agent {} failed while running {}: {:?}" ,
382373 auth. name,
@@ -393,7 +384,7 @@ fn endpoint_error(
393384 Ok ( ApiResponse :: Success { result : true } . into_response ( ) ?)
394385}
395386
396- fn handle_results ( resp : Fallible < Response < Body > > ) -> Response < Body > {
387+ fn handle_results ( resp : Fallible < Response > ) -> Response {
397388 match resp {
398389 Ok ( resp) => resp,
399390 Err ( err) => ApiResponse :: internal_error ( err. to_string ( ) )
@@ -402,7 +393,7 @@ fn handle_results(resp: Fallible<Response<Body>>) -> Response<Body> {
402393 }
403394}
404395
405- async fn handle_errors ( err : Rejection ) -> Result < Response < Body > , Rejection > {
396+ async fn handle_errors ( err : Rejection ) -> Result < Response , Rejection > {
406397 let error = if let Some ( compat) = err. find :: < HttpError > ( ) {
407398 Some ( * compat)
408399 } else if err. is_not_found ( ) {
0 commit comments