1
1
//! Releases web handlers
2
2
3
3
use crate :: {
4
- build_queue:: QueuedCrate ,
4
+ build_queue:: { QueuedCrate , REBUILD_PRIORITY } ,
5
5
cdn, impl_axum_webpage,
6
6
utils:: { report_error, retry_async} ,
7
7
web:: {
@@ -782,16 +782,24 @@ pub(crate) async fn activity_handler(mut conn: DbConnection) -> AxumResult<impl
782
782
struct BuildQueuePage {
783
783
description : & ' static str ,
784
784
queue : Vec < QueuedCrate > ,
785
+ rebuild_queue : Vec < QueuedCrate > ,
785
786
active_cdn_deployments : Vec < String > ,
786
787
in_progress_builds : Vec < ( String , String ) > ,
787
788
csp_nonce : String ,
789
+ expand_rebuild_queue : bool ,
788
790
}
789
791
790
792
impl_axum_webpage ! { BuildQueuePage }
791
793
794
+ #[ derive( Deserialize ) ]
795
+ pub ( crate ) struct BuildQueueParams {
796
+ expand : Option < String > ,
797
+ }
798
+
792
799
pub ( crate ) async fn build_queue_handler (
793
800
Extension ( build_queue) : Extension < Arc < AsyncBuildQueue > > ,
794
801
mut conn : DbConnection ,
802
+ Query ( params) : Query < BuildQueueParams > ,
795
803
) -> AxumResult < impl IntoResponse > {
796
804
let mut active_cdn_deployments: Vec < _ > = cdn:: queued_or_active_crate_invalidations ( & mut conn)
797
805
. await ?
@@ -823,6 +831,7 @@ pub(crate) async fn build_queue_handler(
823
831
. map ( |rec| ( rec. name , rec. version ) )
824
832
. collect ( ) ;
825
833
834
+ let mut rebuild_queue = Vec :: new ( ) ;
826
835
let queue: Vec < QueuedCrate > = build_queue
827
836
. queued_crates ( )
828
837
. await ?
@@ -834,10 +843,14 @@ pub(crate) async fn build_queue_handler(
834
843
} )
835
844
} )
836
845
. map ( |mut krate| {
837
- // The priority here is inverted: in the database if a crate has a higher priority it
838
- // will be built after everything else, which is counter-intuitive for people not
839
- // familiar with docs.rs's inner workings.
840
- krate. priority = -krate. priority ;
846
+ if krate. priority >= REBUILD_PRIORITY {
847
+ rebuild_queue. push ( krate. clone ( ) ) ;
848
+ } else {
849
+ // The priority here is inverted: in the database if a crate has a higher priority it
850
+ // will be built after everything else, which is counter-intuitive for people not
851
+ // familiar with docs.rs's inner workings.
852
+ krate. priority = -krate. priority ;
853
+ }
841
854
842
855
krate
843
856
} )
@@ -846,9 +859,11 @@ pub(crate) async fn build_queue_handler(
846
859
Ok ( BuildQueuePage {
847
860
description : "crate documentation scheduled to build & deploy" ,
848
861
queue,
862
+ rebuild_queue,
849
863
active_cdn_deployments,
850
864
in_progress_builds,
851
865
csp_nonce : String :: new ( ) ,
866
+ expand_rebuild_queue : params. expand . is_some ( ) ,
852
867
} )
853
868
}
854
869
0 commit comments