mirror of
				https://github.com/Swatinem/rust-cache.git
				synced 2025-10-31 16:03:48 +00:00 
			
		
		
		
	Discard files older than 3 days from cache
This commit is contained in:
		
							parent
							
								
									3abbfe0f3f
								
							
						
					
					
						commit
						2f124887c3
					
				
							
								
								
									
										4
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/restore/index.js
									
									
									
									
										vendored
									
									
								
							| @ -87258,7 +87258,7 @@ async function cleanGit(packages) { | ||||
|     } | ||||
|     catch { } | ||||
| } | ||||
| const ONE_WEEK = 7 * 24 * 3600 * 1000; | ||||
| const THREE_DAYS = 3 * 24 * 3600 * 1000; | ||||
| /** | ||||
|  * Removes all files or directories in `dirName` matching some criteria. | ||||
|  * | ||||
| @ -87275,7 +87275,7 @@ async function rmExcept(dirName, keepPrefix, checkTimestamp = false) { | ||||
|         if (checkTimestamp) { | ||||
|             const fileName = external_path_default().join(dir.path, dirent.name); | ||||
|             const { mtime } = await external_fs_default().promises.stat(fileName); | ||||
|             const isOutdated = Date.now() - mtime.getTime() > ONE_WEEK; | ||||
|             const isOutdated = Date.now() - mtime.getTime() > THREE_DAYS; | ||||
|             if (isOutdated) { | ||||
|                 await rm(dir.path, dirent); | ||||
|             } | ||||
|  | ||||
							
								
								
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -87258,7 +87258,7 @@ async function cleanGit(packages) { | ||||
|     } | ||||
|     catch { } | ||||
| } | ||||
| const ONE_WEEK = 7 * 24 * 3600 * 1000; | ||||
| const THREE_DAYS = 3 * 24 * 3600 * 1000; | ||||
| /** | ||||
|  * Removes all files or directories in `dirName` matching some criteria. | ||||
|  * | ||||
| @ -87275,7 +87275,7 @@ async function rmExcept(dirName, keepPrefix, checkTimestamp = false) { | ||||
|         if (checkTimestamp) { | ||||
|             const fileName = external_path_default().join(dir.path, dirent.name); | ||||
|             const { mtime } = await external_fs_default().promises.stat(fileName); | ||||
|             const isOutdated = Date.now() - mtime.getTime() > ONE_WEEK; | ||||
|             const isOutdated = Date.now() - mtime.getTime() > THREE_DAYS; | ||||
|             if (isOutdated) { | ||||
|                 await rm(dir.path, dirent); | ||||
|             } | ||||
| @ -87351,7 +87351,7 @@ async function run() { | ||||
|             allPackages.push(...packages); | ||||
|             try { | ||||
|                 core.info(`... Cleaning ${workspace.target} ...`); | ||||
|                 await cleanTargetDir(workspace.target, packages); | ||||
|                 await cleanTargetDir(workspace.target, packages, true); | ||||
|             } | ||||
|             catch (e) { | ||||
|                 core.debug(`${e.stack}`); | ||||
|  | ||||
| @ -253,7 +253,7 @@ export async function cleanGit(packages: Packages) { | ||||
|   } catch {} | ||||
| } | ||||
| 
 | ||||
| const ONE_WEEK = 7 * 24 * 3600 * 1000; | ||||
| const THREE_DAYS = 3 * 24 * 3600 * 1000; | ||||
| 
 | ||||
| /** | ||||
|  * Removes all files or directories in `dirName` matching some criteria. | ||||
| @ -271,7 +271,7 @@ async function rmExcept(dirName: string, keepPrefix: Set<string>, checkTimestamp | ||||
|     if (checkTimestamp) { | ||||
|       const fileName = path.join(dir.path, dirent.name); | ||||
|       const { mtime } = await fs.promises.stat(fileName); | ||||
|       const isOutdated = Date.now() - mtime.getTime() > ONE_WEEK; | ||||
|       const isOutdated = Date.now() - mtime.getTime() > THREE_DAYS; | ||||
| 
 | ||||
|       if (isOutdated) { | ||||
|         await rm(dir.path, dirent); | ||||
|  | ||||
| @ -47,7 +47,7 @@ async function run() { | ||||
|       allPackages.push(...packages); | ||||
|       try { | ||||
|         core.info(`... Cleaning ${workspace.target} ...`); | ||||
|         await cleanTargetDir(workspace.target, packages); | ||||
|         await cleanTargetDir(workspace.target, packages, true); | ||||
|       } catch (e) { | ||||
|         core.debug(`${(e as any).stack}`); | ||||
|       } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user