Skip to content

Commit

Permalink
Don't follow symlinks when hashing cache files (#10)
Browse files Browse the repository at this point in the history
Fixes performance regression in 2eb83dc
  • Loading branch information
p0deje authored Mar 13, 2024
1 parent 1cc0c15 commit c033bc0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95859,7 +95859,12 @@ async function saveCache(cacheConfig) {
try {
core.startGroup(`Save cache for ${cacheConfig.name}`)
const paths = cacheConfig.paths
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
const hash = await glob.hashFiles(
cacheConfig.files.join('\n'),
undefined,
// We don't want to follow symlinks as it's extremely slow on macOS.
{ followSymbolicLinks: false }
)
const key = `${config.baseCacheKey}-${cacheConfig.name}-${hash}`
console.log(`Attempting to save ${paths} cache to ${key}`)
await cache.saveCache(paths, key)
Expand Down
2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion post.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ async function saveCache(cacheConfig) {
try {
core.startGroup(`Save cache for ${cacheConfig.name}`)
const paths = cacheConfig.paths
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
const hash = await glob.hashFiles(
cacheConfig.files.join('\n'),
undefined,
// We don't want to follow symlinks as it's extremely slow on macOS.
{ followSymbolicLinks: false }
)
const key = `${config.baseCacheKey}-${cacheConfig.name}-${hash}`
console.log(`Attempting to save ${paths} cache to ${key}`)
await cache.saveCache(paths, key)
Expand Down

0 comments on commit c033bc0

Please sign in to comment.