diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-09-06 13:29:16 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-09-06 13:29:16 +0000 |
commit | 021fb512e3c3f4b317307358dee8eecf448599b0 (patch) | |
tree | c0887470c8b94334047cd7e4f9050af92891b118 /lib | |
parent | b97f9629cabadca1125351a8aa514791524dea3f (diff) | |
parent | 758f18b213791bd8f19125c8da76961cffee0e18 (diff) | |
download | gitlab-ce-021fb512e3c3f4b317307358dee8eecf448599b0.tar.gz |
Merge branch 'gitaly-shell-redis-2' into 'master'
Internal API changes to decouple redis from Shell
Closes gitaly#520
See merge request !13971
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/helpers/internal_helpers.rb | 9 | ||||
-rw-r--r-- | lib/api/internal.rb | 11 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/api/helpers/internal_helpers.rb b/lib/api/helpers/internal_helpers.rb index f57ff0f2632..4c0db4d42b1 100644 --- a/lib/api/helpers/internal_helpers.rb +++ b/lib/api/helpers/internal_helpers.rb @@ -46,6 +46,15 @@ module API ::MergeRequests::GetUrlsService.new(project).execute(params[:changes]) end + def redis_ping + result = Gitlab::Redis::SharedState.with { |redis| redis.ping } + + result == 'PONG' + rescue => e + Rails.logger.warn("GitLab: An unexpected error occurred in pinging to Redis: #{e}") + false + end + private def set_project diff --git a/lib/api/internal.rb b/lib/api/internal.rb index 622bd9650e4..c0fef56378f 100644 --- a/lib/api/internal.rb +++ b/lib/api/internal.rb @@ -88,7 +88,8 @@ module API { api_version: API.version, gitlab_version: Gitlab::VERSION, - gitlab_rev: Gitlab::REVISION + gitlab_rev: Gitlab::REVISION, + redis: redis_ping } end @@ -142,6 +143,14 @@ module API { success: true, recovery_codes: codes } end + post '/pre_receive' do + status 200 + + reference_counter_increased = Gitlab::ReferenceCounter.new(params[:gl_repository]).increase + + { reference_counter_increased: reference_counter_increased } + end + post "/notify_post_receive" do status 200 |