@@ -5,6 +5,8 @@ import * as api from "./api";
55import { LogZip } from "./zip" ;
66
77const DISTINCT_ID = uuid ( ) ;
8+ const WORKFLOW_FETCH_TIMEOUT_MS = 60 * 1000 ;
9+ const WORKFLOW_LOGS_RETRY_MS = 2500 ;
810
911async function run ( ) : Promise < void > {
1012 try {
@@ -26,7 +28,6 @@ async function run(): Promise<void> {
2628 await api . dispatchWorkflow ( DISTINCT_ID ) ;
2729
2830 const timeoutMs = config . workflowTimeoutSeconds * 1000 ;
29- const workflowFetchTimeoutMs = 60 * 1000 ;
3031 let attemptNo = 0 ;
3132 let elapsedTime = Date . now ( ) - startTime ;
3233 core . info ( "Attempt to extract run ID from logs..." ) ;
@@ -39,7 +40,9 @@ async function run(): Promise<void> {
3940 // Get all runs for a given workflow ID
4041 const workflowRunIds = await api . retryOrDie (
4142 ( ) => api . getWorkflowRunIds ( workflowId ) ,
42- workflowFetchTimeoutMs > timeoutMs ? timeoutMs : workflowFetchTimeoutMs
43+ WORKFLOW_FETCH_TIMEOUT_MS > timeoutMs
44+ ? timeoutMs
45+ : WORKFLOW_FETCH_TIMEOUT_MS
4346 ) ;
4447
4548 core . debug ( `Attempting to get logs for Run IDs: [${ workflowRunIds } ]` ) ;
@@ -77,7 +80,9 @@ async function run(): Promise<void> {
7780 `Exhausted fetched logs for known runs, attempt ${ attemptNo } ...`
7881 ) ;
7982
80- await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) ) ;
83+ await new Promise ( ( resolve ) =>
84+ setTimeout ( resolve , WORKFLOW_LOGS_RETRY_MS )
85+ ) ;
8186 }
8287
8388 throw new Error ( "Timeout exceeded while attempting to get Run ID" ) ;
0 commit comments