Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
add logs for restore api
Browse files Browse the repository at this point in the history
  • Loading branch information
burnerlee committed Mar 5, 2024
1 parent 785c2b6 commit 26bf8c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions sources/src/config/input.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ inputs:
dependency-graph: disabled
dependency-graph-continue-on-failure: "false"
gradle-user-home: "build-cache"
cache-shared-directory: /data/cache
project-directory: /workspace/code
cache-shared-directory: /Users/burnerlee/test-shared-cache
project-directory: /Users/burnerlee/Projects/random/yetCalc

project-name: topcorn
cache-manager-endpoint: https://cache-server.ea37c239a8.dashwave.live
cache-manager-endpoint: http://localhost:5678
project-branch: master
4 changes: 3 additions & 1 deletion sources/src/s3-cache/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export async function restoreCache(paths: string[], primaryKey: string, restoreK
const data = await response.json();
switch (statusCode) {
case 200:
const cachePath = data.path;
const cachePath = String(data.path);
if (fs.existsSync(cachePath)) {
logger.info("restoring cache from " + cachePath)
const metadataPath = data.metadata_file_path;
const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf8'));
const srcFiles = metadata.files.map((file: string) => path.resolve(cachePath, file));
Expand All @@ -51,6 +52,7 @@ export async function restoreCache(paths: string[], primaryKey: string, restoreK
}
})
fs.rmSync(cachePath, { recursive: true })
logger.info("removing temp cache path", cachePath)
logger.info("restored cache to " + gradleUserHome)
logger.info("time taken to restore cache: " + (Date.now() - timeCpStarted) + "ms")

Expand Down

0 comments on commit 26bf8c4

Please sign in to comment.