Skip to content

Commit 3d523f9

Browse files
committed
Remove the cache validation
The cache validation worked based on timestamps. I believe this may be unreliable in a workflow pipeline with cached assets. Instead, we now rely on the digest of the file. If the source file changes then so should the digest. And therefore it would not find a file in the cache.
1 parent 9751383 commit 3d523f9

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

lib/jekyll/transcode-image-filters.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ def _in_cache? (absolute_path_source, absolute_path_destination)
5252
File.exist?(absolute_path_destination)
5353
end
5454

55-
# Determine whether the file in the cache is still valid. It does so by comparing the modification times of the files.
56-
# @param absolute_path_source [String] As an example: "C:/jekyll/jekyll-transcode-image-filters"
57-
# @param absolute_path_destination [String] As an example: "/assets/image-a.png" or "/assets/image-a.bmp"
58-
# @return [Boolean] If true, the file should be skipped.
59-
def _valid_cache? (absolute_path_source, absolute_path_destination)
60-
File.mtime(absolute_path_destination) >= File.mtime(absolute_path_source)
61-
end
62-
6355
# Read, process, and write the (new) image to disk.
6456
# @param absolute_path_source [String] As an example: "C:/jekyll/jekyll-transcode-image-filters/assets/image-a.png"
6557
# @param absolute_path_destination [String] As an example: "C:/jekyll/jekyll-transcode-image-filters/assets/image-a-processed.png"
@@ -96,7 +88,7 @@ def _transcode_image (relative_source_path, cache_dir, resolution, format)
9688
# Guarantee the existence of the cache directory
9789
FileUtils.mkdir_p(absolute_path_cache)
9890

99-
if _in_cache?(absolute_path_source, absolute_path_destination) && _valid_cache?(absolute_path_source, absolute_path_destination)
91+
if _in_cache?(absolute_path_source, absolute_path_destination)
10092
# if the file is cached and valid we can just return the relative path
10193
return relative_path_destination
10294
else

0 commit comments

Comments
 (0)