diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /app/services/user_project_access_changed_service.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'app/services/user_project_access_changed_service.rb')
-rw-r--r-- | app/services/user_project_access_changed_service.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/services/user_project_access_changed_service.rb b/app/services/user_project_access_changed_service.rb index f52502e0379..5f48f410bf7 100644 --- a/app/services/user_project_access_changed_service.rb +++ b/app/services/user_project_access_changed_service.rb @@ -20,8 +20,13 @@ class UserProjectAccessChangedService if priority == HIGH_PRIORITY AuthorizedProjectsWorker.bulk_perform_async(bulk_args) # rubocop:disable Scalability/BulkPerformWithContext else - AuthorizedProjectUpdate::UserRefreshFromReplicaWorker.bulk_perform_in( # rubocop:disable Scalability/BulkPerformWithContext - DELAY, bulk_args, batch_size: 100, batch_delay: 30.seconds) + with_related_class_context do + # We wrap the execution in `with_related_class_context`so as to obtain + # the location of the original caller + # in jobs enqueued from within `AuthorizedProjectUpdate::UserRefreshFromReplicaWorker` + AuthorizedProjectUpdate::UserRefreshFromReplicaWorker.bulk_perform_in( # rubocop:disable Scalability/BulkPerformWithContext + DELAY, bulk_args, batch_size: 100, batch_delay: 30.seconds) + end end end @@ -29,4 +34,11 @@ class UserProjectAccessChangedService result end + + private + + def with_related_class_context(&block) + current_caller_id = Gitlab::ApplicationContext.current_context_attribute('meta.caller_id').presence + Gitlab::ApplicationContext.with_context(related_class: current_caller_id, &block) + end end |