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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-27 15:10:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-27 15:10:16 +0300
commitaf3904f9d0c9abab61f96f63d0c889f54e31fabd (patch)
tree3e37e9766bf290c0e65aa7c9628f0ec247427f26 /app/models/project_authorization.rb
parent1b9f574b89cb80cdd5af8cba3ad3e7995a4af47d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project_authorization.rb')
-rw-r--r--app/models/project_authorization.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/project_authorization.rb b/app/models/project_authorization.rb
index a55d4891989..8b43e5e5d63 100644
--- a/app/models/project_authorization.rb
+++ b/app/models/project_authorization.rb
@@ -2,6 +2,8 @@
class ProjectAuthorization < ApplicationRecord
BATCH_SIZE = 1000
+ SLEEP_DELAY = 0.1
+
extend SuppressCompositePrimaryKeyWarning
include FromUnion
@@ -55,12 +57,16 @@ class ProjectAuthorization < ApplicationRecord
end
private_class_method def self.add_delay_between_batches?(entire_size:, batch_size:)
+ # The reason for adding a delay is to give the replica database enough time to
+ # catch up with the primary when large batches of records are being added/removed.
+ # Hance, we add a delay only if the GitLab installation has a replica database configured.
entire_size > batch_size &&
+ !::Gitlab::Database::LoadBalancing.primary_only? &&
Feature.enabled?(:enable_minor_delay_during_project_authorizations_refresh)
end
private_class_method def self.perform_delay
- sleep(0.1)
+ sleep(SLEEP_DELAY)
end
end