diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 00:09:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 00:09:33 +0000 |
commit | b56027c9d80ac0e297ba8a43c81e8504172dbf9f (patch) | |
tree | b85f743277145e930ae195664655d696e6e0a7fc /app/models/snippet.rb | |
parent | 7915c41e4261719719e791602c8235574157164c (diff) | |
download | gitlab-ce-b56027c9d80ac0e297ba8a43c81e8504172dbf9f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r-- | app/models/snippet.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 973bdc54111..cfe1c77ec48 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -262,6 +262,15 @@ class Snippet < ApplicationRecord @repository ||= Repository.new(full_path, self, shard: repository_storage, disk_path: disk_path, repo_type: Gitlab::GlRepository::SNIPPET) end + def repository_size_checker + strong_memoize(:repository_size_checker) do + ::Gitlab::RepositorySizeChecker.new( + current_size_proc: -> { repository._uncached_size.megabytes }, + limit: Gitlab::CurrentSettings.snippet_size_limit + ) + end + end + def storage @storage ||= Storage::Hashed.new(self, prefix: Storage::Hashed::SNIPPET_REPOSITORY_PATH_PREFIX) end |