@@ -3,6 +3,7 @@ pub mod comparison_summary;
3
3
4
4
use crate :: api:: github:: Commit ;
5
5
use crate :: load:: { SiteCtxt , TryCommit } ;
6
+ use std:: time:: Duration ;
6
7
7
8
use serde:: Deserialize ;
8
9
@@ -257,22 +258,44 @@ pub async fn enqueue_shas(
257
258
sha : commit_response. sha ,
258
259
parent_sha : commit_response. parents . remove ( 0 ) . sha ,
259
260
} ;
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 (
263
264
pr_number,
264
265
& try_commit. sha ,
265
266
& try_commit. parent_sha ,
266
267
Some ( commit_response. commit . committer . date ) ,
267
268
)
268
- . await
269
- } ;
269
+ . await ;
270
270
if queued {
271
271
if !msg. is_empty ( ) {
272
272
msg. push ( '\n' ) ;
273
273
}
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
+
274
297
msg. push_str ( & format ! (
275
- "Queued {} with parent {}, future [comparison URL]({})." ,
298
+ "Queued {} with parent {}, future [comparison URL]({}).\n {queue_msg} " ,
276
299
try_commit. sha,
277
300
try_commit. parent_sha,
278
301
try_commit. comparison_url( ) ,
0 commit comments