From ff2c52461146fe3f983a215d2865cc101b410729 Mon Sep 17 00:00:00 2001 From: bethanyj28 Date: Thu, 21 Dec 2023 09:25:34 -0500 Subject: [PATCH] lint and format --- .../internal/download/download-artifact.ts | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/artifact/src/internal/download/download-artifact.ts b/packages/artifact/src/internal/download/download-artifact.ts index b7698102..38837642 100644 --- a/packages/artifact/src/internal/download/download-artifact.ts +++ b/packages/artifact/src/internal/download/download-artifact.ts @@ -17,7 +17,6 @@ import { } from '../../generated' import {getBackendIdsFromToken} from '../shared/util' import {ArtifactNotFoundError} from '../shared/errors' -import { clear } from 'console' const scrubQueryParameters = (url: string): string => { const parsed = new URL(url) @@ -42,12 +41,14 @@ async function streamExtract(url: string, directory: string): Promise { let retryCount = 0 while (retryCount < 5) { try { - await streamExtractInternal(url, directory) - core.info(`Artifact downloaded successfully after ${retryCount} retries.`) - return + await streamExtractInternal(url, directory) + core.info(`Artifact downloaded successfully after ${retryCount} retries.`) + return } catch (error) { retryCount++ - core.warning(`Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`) + core.warning( + `Failed to download artifact after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...` + ) // wait 5 seconds before retrying await new Promise(resolve => setTimeout(resolve, 5000)) } @@ -56,7 +57,10 @@ async function streamExtract(url: string, directory: string): Promise { throw new Error(`Artifact download failed after ${retryCount} retries.`) } -async function streamExtractInternal(url: string,directory: string): Promise { +async function streamExtractInternal( + url: string, + directory: string +): Promise { const client = new httpClient.HttpClient(getUserAgentString()) const response = await client.get(url) @@ -71,17 +75,21 @@ async function streamExtractInternal(url: string,directory: string): Promise { const timerFn = (): void => { // close response stream - core.warning("timerFn: closing response stream") - response.message.destroy(new Error(`Blob storage chunk did not respond in ${timeout}ms`)) + core.warning('timerFn: closing response stream') + response.message.destroy( + new Error(`Blob storage chunk did not respond in ${timeout}ms`) + ) } - let timer = setTimeout(timerFn, timeout) + const timer = setTimeout(timerFn, timeout) response.message .on('data', () => { timer.refresh() }) .on('error', (error: Error) => { - core.warning(`response.message: Artifact download failed: ${error.message}`) + core.warning( + `response.message: Artifact download failed: ${error.message}` + ) clearTimeout(timer) reject(error) })