diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-28 10:30:24 +0100 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-28 21:29:47 +0100 |
commit | 4e9b7dbc7e42626ca4f4676ad91f17951f97af9a (patch) | |
tree | 78efb447c818627bebe8a85073d9b7b2250378db /lib/gitlab_access.rb | |
parent | 3043b31c458bf720843a84b35c9fbad5c1488c1d (diff) | |
download | gitlab-shell-memory-limit.tar.gz |
sends message if the project is above the memory limitmemory-limit
Diffstat (limited to 'lib/gitlab_access.rb')
-rw-r--r-- | lib/gitlab_access.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab_access.rb b/lib/gitlab_access.rb index 04806b2..8e3c74f 100644 --- a/lib/gitlab_access.rb +++ b/lib/gitlab_access.rb @@ -6,6 +6,7 @@ require 'json' class GitlabAccess class AccessDeniedError < StandardError; end + class MemoryLimitReachedError < StandardError; end include NamesHelper @@ -24,6 +25,7 @@ class GitlabAccess status = api.check_access('git-receive-pack', @repo_name, @actor, @changes, @protocol) raise AccessDeniedError, status.message unless status.allowed? + raise MemoryLimitReachedError, status.memory_message if status.memory_limit? true rescue GitlabNet::ApiUnreachableError @@ -32,6 +34,9 @@ class GitlabAccess rescue AccessDeniedError => ex $stderr.puts "GitLab: #{ex.message}" false + rescue MemoryLimitReachedError => ex + $stderr.puts "Gitlab: Project has reached the memory limit by: #{ex.message}MB please free some memory in Gitlab's UI to be able to push." + false end protected |