@@ -582,9 +582,23 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
582582 // listen for a message with a timeout, and on timeout we run the
583583 // previous parts of the loop again.
584584 let events: Vec < _ > = self . rx . try_iter ( ) . collect ( ) ;
585+ info ! (
586+ "tokens in use: {}, rustc_tokens: {:?}, waiting_rustcs: {:?} (events this tick: {})" ,
587+ self . tokens. len( ) ,
588+ self . rustc_tokens
589+ . iter( )
590+ . map( |( k, j) | ( k, j. len( ) ) )
591+ . collect:: <Vec <_>>( ) ,
592+ self . to_send_clients
593+ . iter( )
594+ . map( |( k, j) | ( k, j. len( ) ) )
595+ . collect:: <Vec <_>>( ) ,
596+ events. len( ) ,
597+ ) ;
585598 if events. is_empty ( ) {
586599 loop {
587600 self . tick_progress ( ) ;
601+ self . tokens . truncate ( self . active . len ( ) - 1 ) ;
588602 match self . rx . recv_timeout ( Duration :: from_millis ( 500 ) ) {
589603 Ok ( message) => break vec ! [ message] ,
590604 Err ( _) => continue ,
@@ -618,13 +632,6 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
618632 loop {
619633 self . spawn_work_if_possible ( cx, jobserver_helper, scope, error. is_some ( ) ) ?;
620634
621- info ! (
622- "tokens: {}, rustc_tokens: {}, waiting_rustcs: {}" ,
623- self . tokens. len( ) ,
624- self . rustc_tokens. len( ) ,
625- self . to_send_clients. len( )
626- ) ;
627-
628635 // If after all that we're not actually running anything then we're
629636 // done!
630637 if self . active . is_empty ( ) {
@@ -638,7 +645,6 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
638645 // jobserver interface is architected we may acquire a token that we
639646 // don't actually use, and if this happens just relinquish it back
640647 // to the jobserver itself.
641- self . tokens . truncate ( self . active . len ( ) - 1 ) ;
642648 for event in self . wait_for_events ( ) {
643649 if let Some ( err) = self . handle_event ( cx, jobserver_helper, plan, event) ? {
644650 error = Some ( err) ;
0 commit comments