Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
31fc5965
Commit
31fc5965
authored
5 years ago
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Monkey-patch Sprockets to prevent cache ballooning
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
97342325
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
config/initializers/sprockets_base_file_digest_key.rb
config/initializers/sprockets_base_file_digest_key.rb
+3
-0
lib/gitlab/patch/sprockets_base_file_digest_key.rb
lib/gitlab/patch/sprockets_base_file_digest_key.rb
+22
-0
No files found.
config/initializers/sprockets_base_file_digest_key.rb
0 → 100644
View file @
31fc5965
# frozen_string_literal: true
Sprockets
::
Base
.
prepend
(
Gitlab
::
Patch
::
SprocketsBaseFileDigestKey
)
This diff is collapsed.
Click to expand it.
lib/gitlab/patch/sprockets_base_file_digest_key.rb
0 → 100644
View file @
31fc5965
# 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
.
hexdigest_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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment