mirror of
				https://kkgithub.com/actions/cache.git
				synced 2025-10-31 02:31:51 +08:00 
			
		
		
		
	error handling for stream
This commit is contained in:
		
							
								
								
									
										6
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @ -1435,11 +1435,15 @@ function uploadFile(httpClient, cacheId, archivePath) { | |||||||
|                     const start = offset; |                     const start = offset; | ||||||
|                     const end = offset + chunkSize - 1; |                     const end = offset + chunkSize - 1; | ||||||
|                     offset += MAX_CHUNK_SIZE; |                     offset += MAX_CHUNK_SIZE; | ||||||
|                     yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, { |                     yield uploadChunk(httpClient, resourceUrl, () => fs | ||||||
|  |                         .createReadStream(archivePath, { | ||||||
|                         fd, |                         fd, | ||||||
|                         start, |                         start, | ||||||
|                         end, |                         end, | ||||||
|                         autoClose: false |                         autoClose: false | ||||||
|  |                     }) | ||||||
|  |                         .on("error", error => { | ||||||
|  |                         throw new Error(`Cache upload failed because file read failed with ${error.Message}`); | ||||||
|                     }), start, end); |                     }), start, end); | ||||||
|                 } |                 } | ||||||
|             }))); |             }))); | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -1434,11 +1434,15 @@ function uploadFile(httpClient, cacheId, archivePath) { | |||||||
|                     const start = offset; |                     const start = offset; | ||||||
|                     const end = offset + chunkSize - 1; |                     const end = offset + chunkSize - 1; | ||||||
|                     offset += MAX_CHUNK_SIZE; |                     offset += MAX_CHUNK_SIZE; | ||||||
|                     yield uploadChunk(httpClient, resourceUrl, () => fs.createReadStream(archivePath, { |                     yield uploadChunk(httpClient, resourceUrl, () => fs | ||||||
|  |                         .createReadStream(archivePath, { | ||||||
|                         fd, |                         fd, | ||||||
|                         start, |                         start, | ||||||
|                         end, |                         end, | ||||||
|                         autoClose: false |                         autoClose: false | ||||||
|  |                     }) | ||||||
|  |                         .on("error", error => { | ||||||
|  |                         throw new Error(`Cache upload failed because file read failed with ${error.Message}`); | ||||||
|                     }), start, end); |                     }), start, end); | ||||||
|                 } |                 } | ||||||
|             }))); |             }))); | ||||||
|  | |||||||
| @ -268,11 +268,17 @@ async function uploadFile( | |||||||
|                         httpClient, |                         httpClient, | ||||||
|                         resourceUrl, |                         resourceUrl, | ||||||
|                         () => |                         () => | ||||||
|                             fs.createReadStream(archivePath, { |                             fs | ||||||
|  |                                 .createReadStream(archivePath, { | ||||||
|                                     fd, |                                     fd, | ||||||
|                                     start, |                                     start, | ||||||
|                                     end, |                                     end, | ||||||
|                                     autoClose: false |                                     autoClose: false | ||||||
|  |                                 }) | ||||||
|  |                                 .on("error", error => { | ||||||
|  |                                     throw new Error( | ||||||
|  |                                         `Cache upload failed because file read failed with ${error.Message}` | ||||||
|  |                                     ); | ||||||
|                                 }), |                                 }), | ||||||
|                         start, |                         start, | ||||||
|                         end |                         end | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Aiqiao Yan
					Aiqiao Yan