From 19cdd5f210c6a71c9b8d163ce8e08a04c62918ee Mon Sep 17 00:00:00 2001 From: Bassem Dghaidi <568794+Link-@users.noreply.github.com> Date: Thu, 14 Nov 2024 03:34:13 -0800 Subject: [PATCH] Linter cleanups --- packages/cache/src/cache.ts | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index 5fba1e82..f5c00053 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -4,8 +4,8 @@ import * as config from './internal/config' import * as utils from './internal/cacheUtils' import * as cacheHttpClient from './internal/cacheHttpClient' import * as cacheTwirpClient from './internal/shared/cacheTwirpClient' -import {DownloadOptions, UploadOptions} from './options' -import {createTar, extractTar, listTar} from './internal/tar' +import { DownloadOptions, UploadOptions } from './options' +import { createTar, extractTar, listTar } from './internal/tar' import { CreateCacheEntryRequest, CreateCacheEntryResponse, @@ -14,9 +14,9 @@ import { GetCacheEntryDownloadURLRequest, GetCacheEntryDownloadURLResponse } from './generated/results/api/v1/cache' -import {CacheFileSizeLimit} from './internal/constants' -import {UploadCacheFile} from './internal/blob/upload-cache' -import {DownloadCacheFile} from './internal/blob/download-cache' +import { CacheFileSizeLimit } from './internal/constants' +import { UploadCacheFile } from './internal/blob/upload-cache' +import { DownloadCacheFile } from './internal/blob/download-cache' export class ValidationError extends Error { constructor(message: string) { super(message) @@ -84,7 +84,6 @@ export async function restoreCache( checkPaths(paths) const cacheServiceVersion: string = config.getCacheServiceVersion() - console.debug(`Cache service version: ${cacheServiceVersion}`) switch (cacheServiceVersion) { case 'v2': return await restoreCachev2( @@ -246,7 +245,7 @@ async function restoreCachev2( workflowRunBackendId: backendIds.workflowRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId, key: primaryKey, - restoreKeys: restoreKeys, + restoreKeys, version: utils.getCacheVersion( paths, compressionMethod, @@ -307,8 +306,6 @@ async function restoreCachev2( core.debug(`Failed to delete archive: ${error}`) } } - - return undefined } /** @@ -330,7 +327,6 @@ export async function saveCache( checkKey(key) const cacheServiceVersion: string = config.getCacheServiceVersion() - console.debug(`Cache Service Version: ${cacheServiceVersion}`) switch (cacheServiceVersion) { case 'v2': return await saveCachev2(paths, key, options, enableCrossOsArchive) @@ -410,9 +406,9 @@ async function saveCachev1( } else if (reserveCacheResponse?.statusCode === 400) { throw new Error( reserveCacheResponse?.error?.message ?? - `Cache size of ~${Math.round( - archiveFileSize / (1024 * 1024) - )} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.` + `Cache size of ~${Math.round( + archiveFileSize / (1024 * 1024) + )} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.` ) } else { throw new ReserveCacheError( @@ -509,8 +505,8 @@ async function saveCachev2( const request: CreateCacheEntryRequest = { workflowRunBackendId: backendIds.workflowRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId, - key: key, - version: version + key, + version } const response: CreateCacheEntryResponse = await twirpClient.CreateCacheEntry(request) @@ -526,8 +522,8 @@ async function saveCachev2( const finalizeRequest: FinalizeCacheEntryUploadRequest = { workflowRunBackendId: backendIds.workflowRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId, - key: key, - version: version, + key, + version, sizeBytes: `${archiveFileSize}` }