mirror of
				https://github.com/actions/cache.git
				synced 2025-11-01 04:28:39 +08:00 
			
		
		
		
	Change to on end
This commit is contained in:
		
							parent
							
								
									2cbd952179
								
							
						
					
					
						commit
						131e247bd2
					
				
							
								
								
									
										8
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -1624,8 +1624,8 @@ function saveCache(cacheId, archivePath) { | ||||||
|         // Upload Chunks
 |         // Upload Chunks
 | ||||||
|         const stream = fs.createReadStream(archivePath); |         const stream = fs.createReadStream(archivePath); | ||||||
|         let streamIsClosed = false; |         let streamIsClosed = false; | ||||||
|         stream.on("close", () => { |         stream.on("end", () => { | ||||||
|             core.debug("Stream is closed"); |             core.debug("Stream is ended"); | ||||||
|             streamIsClosed = true; |             streamIsClosed = true; | ||||||
|         }); |         }); | ||||||
|         const resourceUrl = getCacheApiUrl() + cacheId.toString(); |         const resourceUrl = getCacheApiUrl() + cacheId.toString(); | ||||||
|  | @ -1634,6 +1634,10 @@ function saveCache(cacheId, archivePath) { | ||||||
|         while (!streamIsClosed) { |         while (!streamIsClosed) { | ||||||
|             core.debug(`Offset: ${offset}`); |             core.debug(`Offset: ${offset}`); | ||||||
|             const chunk = stream.read(MAX_CHUNK_SIZE); |             const chunk = stream.read(MAX_CHUNK_SIZE); | ||||||
|  |             if (chunk == null) { | ||||||
|  |                 core.debug(`Chunk is null, reading is over?`); | ||||||
|  |                 break; | ||||||
|  |             } | ||||||
|             uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); |             uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); | ||||||
|             offset += MAX_CHUNK_SIZE; |             offset += MAX_CHUNK_SIZE; | ||||||
|         } |         } | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							|  | @ -1624,8 +1624,8 @@ function saveCache(cacheId, archivePath) { | ||||||
|         // Upload Chunks
 |         // Upload Chunks
 | ||||||
|         const stream = fs.createReadStream(archivePath); |         const stream = fs.createReadStream(archivePath); | ||||||
|         let streamIsClosed = false; |         let streamIsClosed = false; | ||||||
|         stream.on("close", () => { |         stream.on("end", () => { | ||||||
|             core.debug("Stream is closed"); |             core.debug("Stream is ended"); | ||||||
|             streamIsClosed = true; |             streamIsClosed = true; | ||||||
|         }); |         }); | ||||||
|         const resourceUrl = getCacheApiUrl() + cacheId.toString(); |         const resourceUrl = getCacheApiUrl() + cacheId.toString(); | ||||||
|  | @ -1634,6 +1634,10 @@ function saveCache(cacheId, archivePath) { | ||||||
|         while (!streamIsClosed) { |         while (!streamIsClosed) { | ||||||
|             core.debug(`Offset: ${offset}`); |             core.debug(`Offset: ${offset}`); | ||||||
|             const chunk = stream.read(MAX_CHUNK_SIZE); |             const chunk = stream.read(MAX_CHUNK_SIZE); | ||||||
|  |             if (chunk == null) { | ||||||
|  |                 core.debug(`Chunk is null, reading is over?`); | ||||||
|  |                 break; | ||||||
|  |             } | ||||||
|             uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); |             uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); | ||||||
|             offset += MAX_CHUNK_SIZE; |             offset += MAX_CHUNK_SIZE; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -185,8 +185,8 @@ export async function saveCache( | ||||||
|     // Upload Chunks
 |     // Upload Chunks
 | ||||||
|     const stream = fs.createReadStream(archivePath); |     const stream = fs.createReadStream(archivePath); | ||||||
|     let streamIsClosed = false; |     let streamIsClosed = false; | ||||||
|     stream.on("close", () => { |     stream.on("end", () => { | ||||||
|         core.debug("Stream is closed"); |         core.debug("Stream is ended"); | ||||||
|         streamIsClosed = true; |         streamIsClosed = true; | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -196,6 +196,10 @@ export async function saveCache( | ||||||
|     while (!streamIsClosed) { |     while (!streamIsClosed) { | ||||||
|         core.debug(`Offset: ${offset}`); |         core.debug(`Offset: ${offset}`); | ||||||
|         const chunk: Buffer = stream.read(MAX_CHUNK_SIZE); |         const chunk: Buffer = stream.read(MAX_CHUNK_SIZE); | ||||||
|  |         if (chunk == null) { | ||||||
|  |             core.debug(`Chunk is null, reading is over?`); | ||||||
|  |             break; | ||||||
|  |         } | ||||||
|         uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); |         uploads.push(uploadChunk(restClient, resourceUrl, chunk, offset)); | ||||||
|         offset += MAX_CHUNK_SIZE; |         offset += MAX_CHUNK_SIZE; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Josh Gross
						Josh Gross