@@ -3,6 +3,7 @@ pub mod comparison_summary;
33
44use crate :: api:: github:: Commit ;
55use crate :: load:: { SiteCtxt , TryCommit } ;
6+ use std:: time:: Duration ;
67
78use serde:: Deserialize ;
89
@@ -257,22 +258,44 @@ pub async fn enqueue_shas(
257258 sha : commit_response. sha ,
258259 parent_sha : commit_response. parents . remove ( 0 ) . sha ,
259260 } ;
260- let queued = {
261- let conn = ctxt . conn ( ) . await ;
262- conn . pr_attach_commit (
261+ let conn = ctxt . conn ( ) . await ;
262+ let queued = conn
263+ . pr_attach_commit (
263264 pr_number,
264265 & try_commit. sha ,
265266 & try_commit. parent_sha ,
266267 Some ( commit_response. commit . committer . date ) ,
267268 )
268- . await
269- } ;
269+ . await ;
270270 if queued {
271271 if !msg. is_empty ( ) {
272272 msg. push ( '\n' ) ;
273273 }
274+
275+ let artifacts_in_queue = ctxt. missing_commits ( ) . await . len ( ) ;
276+ let last_duration = conn
277+ . last_artifact_collection ( )
278+ . await
279+ . map ( |collection| collection. duration )
280+ . unwrap_or ( Duration :: ZERO ) ;
281+
282+ // "Guess" that the duration will take about an hour if we don't have data or it's
283+ // suspiciously fast.
284+ let last_duration = last_duration. max ( Duration :: from_secs ( 3600 ) ) ;
285+
286+ let expected_duration = ( last_duration. as_secs ( ) * artifacts_in_queue as u64 ) as f64 ;
287+
288+ // At this point, the queue should also contain the commit that we're mentioning below.
289+ let other_artifact_count = artifacts_in_queue. saturating_sub ( 1 ) ;
290+ let suffix = if other_artifact_count == 1 { "" } else { "s" } ;
291+ let queue_msg = format ! (
292+ r#"There are currently {other_artifact_count} other artifact{suffix} in the [queue](https://perf.rust-lang.org/status.html).
293+ It will probably take at least ~{:.2} hours until the benchmark run finishes."# ,
294+ ( expected_duration / 3600.0 )
295+ ) ;
296+
274297 msg. push_str ( & format ! (
275- "Queued {} with parent {}, future [comparison URL]({})." ,
298+ "Queued {} with parent {}, future [comparison URL]({}).\n {queue_msg} " ,
276299 try_commit. sha,
277300 try_commit. parent_sha,
278301 try_commit. comparison_url( ) ,
0 commit comments