mirror of
				https://github.com/Swatinem/rust-cache.git
				synced 2025-10-31 19:53:49 +00:00 
			
		
		
		
	log individual timings
This commit is contained in:
		
							parent
							
								
									a6b59fa340
								
							
						
					
					
						commit
						271ff4b692
					
				| @ -12,10 +12,11 @@ async function run() { | ||||
| 
 | ||||
|     const caches = await getCaches(); | ||||
|     for (const [type, { name, path, key, restoreKeys }] of Object.entries(caches)) { | ||||
|       const start = Date.now(); | ||||
|       core.startGroup(`Restoring ${name}"…`); | ||||
|       core.info(`Restoring to path "${path}".`); | ||||
|       core.info(`Using keys:\n    ${[key, ...restoreKeys].join("\n    ")}`); | ||||
|       try { | ||||
|         core.startGroup(`Restoring ${name}"…`); | ||||
|         core.info(`Restoring to path "${path}".`); | ||||
|         core.info(`Using keys:\n    ${[key, ...restoreKeys].join("\n    ")}`); | ||||
|         const restoreKey = await cache.restoreCache([path], key, restoreKeys); | ||||
|         if (restoreKey) { | ||||
|           core.info(`Restored from cache key "${restoreKey}".`); | ||||
| @ -25,9 +26,12 @@ async function run() { | ||||
|         } | ||||
|       } catch (e) { | ||||
|         core.info(`[warning] ${e.message}`); | ||||
|       } finally { | ||||
|         core.endGroup(); | ||||
|       } | ||||
|       const duration = Math.round((Date.now() - start) / 1000); | ||||
|       if (duration) { | ||||
|         core.info(`Took ${duration}s.`); | ||||
|       } | ||||
|       core.endGroup(); | ||||
|     } | ||||
|   } catch (e) { | ||||
|     core.info(`[warning] ${e.message}`); | ||||
|  | ||||
							
								
								
									
										14
									
								
								src/save.ts
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								src/save.ts
									
									
									
									
									
								
							| @ -38,16 +38,20 @@ async function run() { | ||||
|         core.info(`${name} up-to-date.`); | ||||
|         continue; | ||||
|       } | ||||
|       const start = Date.now(); | ||||
|       core.startGroup(`Saving ${name}…`); | ||||
|       core.info(`Saving path "${path}".`); | ||||
|       core.info(`Using key "${key}".`); | ||||
|       try { | ||||
|         core.startGroup(`Saving ${name}…`); | ||||
|         core.info(`Saving path "${path}".`); | ||||
|         core.info(`Using key "${key}".`); | ||||
|         await cache.saveCache([path], key); | ||||
|       } catch (e) { | ||||
|         core.info(`[warning] ${e.message}`); | ||||
|       } finally { | ||||
|         core.endGroup(); | ||||
|       } | ||||
|       const duration = Math.round((Date.now() - start) / 1000); | ||||
|       if (duration) { | ||||
|         core.info(`Took ${duration}s.`); | ||||
|       } | ||||
|       core.endGroup(); | ||||
|     } | ||||
|   } catch (e) { | ||||
|     core.info(`[warning] ${e.message}`); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user