From 0e122bfdb1bcf7e5d724eee0dbee922c97a99e75 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 22 Mar 2017 18:52:13 +0100 Subject: Make CI API to always use primary DB --- changelogs/unreleased/make-ci-api-to-always-use-primary.yml | 4 ++++ lib/api/runner.rb | 2 ++ lib/ci/api/builds.rb | 2 ++ 3 files changed, 8 insertions(+) create mode 100644 changelogs/unreleased/make-ci-api-to-always-use-primary.yml diff --git a/changelogs/unreleased/make-ci-api-to-always-use-primary.yml b/changelogs/unreleased/make-ci-api-to-always-use-primary.yml new file mode 100644 index 00000000000..2c2f9765f18 --- /dev/null +++ b/changelogs/unreleased/make-ci-api-to-always-use-primary.yml @@ -0,0 +1,4 @@ +--- +title: Make CI API to always use primary DB +merge_request: +author: diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 4c9db2c8716..3d691469fe6 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -83,6 +83,8 @@ module API return no_content! end + Gitlab::Database::LoadBalancing::Session.current.use_primary! + new_update = current_runner.ensure_runner_queue_value result = ::Ci::RegisterJobService.new(current_runner).execute diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb index 746e76a1b1f..972a6307d89 100644 --- a/lib/ci/api/builds.rb +++ b/lib/ci/api/builds.rb @@ -22,6 +22,8 @@ module Ci return build_not_found! end + Gitlab::Database::LoadBalancing::Session.current.use_primary! + new_update = current_runner.ensure_runner_queue_value result = Ci::RegisterJobService.new(current_runner).execute -- cgit v1.2.1