mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 20:08:36 +08:00 
			
		
		
		
	Initialize s3client once
This commit is contained in:
		
							parent
							
								
									df4fed6d95
								
							
						
					
					
						commit
						6de5dcf3c3
					
				|  | @ -48,6 +48,8 @@ const downloadQueueSize = Number(process.env.DOWNLOAD_QUEUE_SIZE || "8"); | ||||||
| const downloadPartSize = | const downloadPartSize = | ||||||
|     Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; |     Number(process.env.DOWNLOAD_PART_SIZE || "16") * 1024 * 1024; | ||||||
| 
 | 
 | ||||||
|  | const s3Client = new S3Client({ region }); | ||||||
|  | 
 | ||||||
| export function getCacheVersion( | export function getCacheVersion( | ||||||
|     paths: string[], |     paths: string[], | ||||||
|     compressionMethod?: CompressionMethod, |     compressionMethod?: CompressionMethod, | ||||||
|  | @ -96,7 +98,6 @@ export async function getCacheEntry( | ||||||
|     { compressionMethod, enableCrossOsArchive } |     { compressionMethod, enableCrossOsArchive } | ||||||
| ) { | ) { | ||||||
|     const cacheEntry: ArtifactCacheEntry = {}; |     const cacheEntry: ArtifactCacheEntry = {}; | ||||||
|     const s3Client = new S3Client({ region }); |  | ||||||
| 
 | 
 | ||||||
|     // Find the most recent key matching one of the restoreKeys prefixes
 |     // Find the most recent key matching one of the restoreKeys prefixes
 | ||||||
|     for (const restoreKey of keys) { |     for (const restoreKey of keys) { | ||||||
|  | @ -147,7 +148,6 @@ export async function downloadCache( | ||||||
|         throw new Error("Environment variable RUNS_ON_AWS_REGION not set"); |         throw new Error("Environment variable RUNS_ON_AWS_REGION not set"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const s3Client = new S3Client({ region }); |  | ||||||
|     const archiveUrl = new URL(archiveLocation); |     const archiveUrl = new URL(archiveLocation); | ||||||
|     const objectKey = archiveUrl.pathname.slice(1); |     const objectKey = archiveUrl.pathname.slice(1); | ||||||
|     const command = new GetObjectCommand({ |     const command = new GetObjectCommand({ | ||||||
|  | @ -179,7 +179,6 @@ export async function saveCache( | ||||||
|         throw new Error("Environment variable RUNS_ON_AWS_REGION not set"); |         throw new Error("Environment variable RUNS_ON_AWS_REGION not set"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const s3Client = new S3Client({ region }); |  | ||||||
|     const s3Prefix = getS3Prefix(paths, { |     const s3Prefix = getS3Prefix(paths, { | ||||||
|         compressionMethod, |         compressionMethod, | ||||||
|         enableCrossOsArchive |         enableCrossOsArchive | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Cyril Rohr
						Cyril Rohr