@@ -2,21 +2,24 @@ use console::style;
22use tokio:: time:: { Instant , sleep} ;
33
44use crate :: api_client:: {
5- CodSpeedAPIClient , FetchLocalExecReportResponse , FetchLocalExecReportVars , RunStatus ,
5+ CodSpeedAPIClient , FetchLocalRunReportResponse , FetchLocalRunReportVars , RunStatus ,
66} ;
7- use crate :: exec :: DEFAULT_REPOSITORY_NAME ;
7+ use crate :: run :: uploader :: UploadResult ;
88use crate :: prelude:: * ;
99use crate :: run:: helpers:: poll_results:: {
1010 POLLING_INTERVAL , RUN_PROCESSING_MAX_DURATION , build_benchmark_table,
1111} ;
1212
1313#[ allow( clippy:: borrowed_box) ]
14- pub async fn poll_results ( api_client : & CodSpeedAPIClient , run_id : String ) -> Result < ( ) > {
14+ pub async fn poll_results (
15+ api_client : & CodSpeedAPIClient ,
16+ upload_result : & UploadResult ,
17+ ) -> Result < ( ) > {
1518 let start = Instant :: now ( ) ;
16- let fetch_local_exec_report_vars = FetchLocalExecReportVars {
17- // TODO: Set this dynamically based on the upload endpoint return value
18- name : DEFAULT_REPOSITORY_NAME . to_owned ( ) ,
19- run_id : run_id. clone ( ) ,
19+ let fetch_local_run_report_vars = FetchLocalRunReportVars {
20+ owner : upload_result . owner . clone ( ) ,
21+ name : upload_result . repository . clone ( ) ,
22+ run_id : upload_result . run_id . clone ( ) ,
2023 } ;
2124
2225 start_group ! ( "Fetching the results" ) ;
@@ -27,11 +30,11 @@ pub async fn poll_results(api_client: &CodSpeedAPIClient, run_id: String) -> Res
2730 }
2831
2932 let fetch_result = api_client
30- . fetch_local_exec_report ( fetch_local_exec_report_vars . clone ( ) )
33+ . fetch_local_run_report ( fetch_local_run_report_vars . clone ( ) )
3134 . await ?;
3235
3336 match fetch_result {
34- FetchLocalExecReportResponse { run, .. }
37+ FetchLocalRunReportResponse { run, .. }
3538 if run. status == RunStatus :: Pending || run. status == RunStatus :: Processing =>
3639 {
3740 sleep ( POLLING_INTERVAL ) . await ;
0 commit comments