summaryrefslogtreecommitdiff
path: root/app/services/projects/group_links/update_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/projects/group_links/update_service.rb')
-rw-r--r--app/services/projects/group_links/update_service.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/app/services/projects/group_links/update_service.rb b/app/services/projects/group_links/update_service.rb
index 7de4b7a211d..475ab17f1a1 100644
--- a/app/services/projects/group_links/update_service.rb
+++ b/app/services/projects/group_links/update_service.rb
@@ -12,15 +12,29 @@ module Projects
def execute(group_link_params)
group_link.update!(group_link_params)
- if requires_authorization_refresh?(group_link_params)
- group_link.group.refresh_members_authorized_projects
- end
+ refresh_authorizations if requires_authorization_refresh?(group_link_params)
end
private
attr_reader :group_link
+ def refresh_authorizations
+ if Feature.enabled?(:specialized_worker_for_project_share_update_auth_recalculation)
+ AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(project.id)
+
+ # Until we compare the inconsistency rates of the new specialized worker and
+ # the old approach, we still run AuthorizedProjectsWorker
+ # but with some delay and lower urgency as a safety net.
+ group_link.group.refresh_members_authorized_projects(
+ blocking: false,
+ priority: UserProjectAccessChangedService::LOW_PRIORITY
+ )
+ else
+ group_link.group.refresh_members_authorized_projects
+ end
+ end
+
def requires_authorization_refresh?(params)
params.include?(:group_access)
end