@@ -685,10 +685,30 @@ impl Database {
685685 "" . to_string ( )
686686 } ;
687687
688+ /*
689+ * Report the assignment in a message that appears in the job event
690+ * stream. Try to include some details about the worker; e.g., the name
691+ * of the factory that created it and the factory-private identifier for
692+ * the backing resource.
693+ */
694+ let mut extra = Vec :: new ( ) ;
695+ if let Some ( fid) = w. factory {
696+ let f = self . i_factory ( h, fid) ?;
697+ extra. push ( format ! ( "factory {}" , f. name) ) ;
698+ }
699+ if let Some ( fp) = w. factory_private . as_deref ( ) {
700+ extra. push ( fp. to_string ( ) ) ;
701+ }
702+ let extra = if extra. is_empty ( ) {
703+ "" . to_string ( )
704+ } else {
705+ format ! ( " [{}]" , extra. join( ", " ) )
706+ } ;
707+
688708 let seq = self . i_job_control_event_insert (
689709 h,
690710 j. id ,
691- & format ! ( "job assigned to worker {}{} " , w. id, wait ) ,
711+ & format ! ( "job assigned to worker {}{extra}{wait} " , w. id) ,
692712 ) ?;
693713
694714 self . i_job_notify ( h, & j, seq, false , true ) ;
@@ -2659,6 +2679,10 @@ impl Database {
26592679 }
26602680
26612681 pub fn factory ( & self , id : FactoryId ) -> DBResult < Factory > {
2682+ self . sql . tx ( |h| self . i_factory ( h, id) )
2683+ }
2684+
2685+ fn i_factory ( & self , h : & mut Handle , id : FactoryId ) -> DBResult < Factory > {
26622686 if id == Worker :: legacy_default_factory_id ( ) {
26632687 /*
26642688 * Factory records for workers that were created prior to the
@@ -2678,7 +2702,7 @@ impl Database {
26782702 } ) ;
26792703 }
26802704
2681- self . sql . tx ( |h| h . get_row ( Factory :: find ( id) ) )
2705+ h . get_row ( Factory :: find ( id) )
26822706 }
26832707
26842708 pub fn factory_auth ( & self , token : & str ) -> DBResult < Factory > {
0 commit comments