8ccf1ea310
Use self.integrity_uri over self.hexdigest_integrity_uri(digest), as the latter always returned nil leading to improper cache invalidation. We are alos enabling caching of `tmp/cache/assets/sprockets` again, to get those performance gains.
22 lines
688 B
Ruby
22 lines
688 B
Ruby
# frozen_string_literal: true
|
|
|
|
# This monkey patch prevent cache ballooning when caching tmp/cache/assets/sprockets
|
|
# on the CI. See https://github.com/rails/sprockets/issues/563 and
|
|
# https://github.com/rails/sprockets/compare/3.x...jmreid:no-mtime-for-digest-key.
|
|
module Gitlab
|
|
module Patch
|
|
module SprocketsBaseFileDigestKey
|
|
def file_digest(path)
|
|
if stat = self.stat(path)
|
|
digest = self.stat_digest(path, stat)
|
|
integrity_uri = self.integrity_uri(digest)
|
|
|
|
key = Sprockets::UnloadedAsset.new(path, self).file_digest_key(integrity_uri)
|
|
cache.fetch(key) do
|
|
digest
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|