@@ -56,14 +56,17 @@ export async function initPinnedWorkflows(store: RunStore) {
5656}
5757
5858async function _init ( ) : Promise < void > {
59+ logDebug ( "Initializing pinned workflows watcher" ) ;
5960 await updatePinnedWorkflows ( ) ;
6061
6162 if ( refreshTimer ) {
63+ logDebug ( "Existing pinned workflows refresh timer found, clearing it" ) ;
6264 clearInterval ( refreshTimer ) ;
6365 refreshTimer = undefined ;
6466 }
6567
6668 if ( isPinnedWorkflowsRefreshEnabled ( ) ) {
69+ logDebug ( "Pinned workflows refresh enabled, checking every" , pinnedWorkflowsRefreshInterval ( ) , "seconds" ) ;
6770 refreshTimer = setInterval ( ( ) => void refreshPinnedWorkflows ( ) , pinnedWorkflowsRefreshInterval ( ) * 1000 ) ;
6871 }
6972}
@@ -116,15 +119,17 @@ async function updatePinnedWorkflows() {
116119 const workflowByPath : { [ id : string ] : Workflow } = { } ;
117120 workflows . forEach ( w => ( workflowByPath [ w . path ] = w ) ) ;
118121
119- for ( const pinnedWorkflow of workflowsByWorkspace . get ( workspaceName ) || [ ] ) {
120- if ( ! workflowByPath [ pinnedWorkflow ] ) {
121- log ( `Unable to find pinned workflow ${ pinnedWorkflow } in ${ workspaceName } , ignoring` ) ;
122- continue ;
123- }
122+ await Promise . all (
123+ ( workflowsByWorkspace . get ( workspaceName ) || [ ] ) . map ( async pinnedWorkflow => {
124+ if ( ! workflowByPath [ pinnedWorkflow ] ) {
125+ log ( `Unable to find pinned workflow ${ pinnedWorkflow } in ${ workspaceName } , ignoring` ) ;
126+ return ;
127+ }
124128
125- const pW = createPinnedWorkflow ( gitHubRepoContext , workflowByPath [ pinnedWorkflow ] ) ;
126- await refreshPinnedWorkflow ( pW ) ;
127- }
129+ const pW = createPinnedWorkflow ( gitHubRepoContext , workflowByPath [ pinnedWorkflow ] ) ;
130+ return refreshPinnedWorkflow ( pW ) ;
131+ } )
132+ ) ;
128133 }
129134}
130135
0 commit comments