Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/make-ci-api-to-always-use-primary.yml4
-rw-r--r--lib/api/runner.rb2
-rw-r--r--lib/ci/api/builds.rb2
3 files changed, 8 insertions, 0 deletions
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