diff options
Diffstat (limited to 'app/services/authorized_project_update/project_access_changed_service.rb')
-rw-r--r-- | app/services/authorized_project_update/project_access_changed_service.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/services/authorized_project_update/project_access_changed_service.rb b/app/services/authorized_project_update/project_access_changed_service.rb new file mode 100644 index 00000000000..62bf4ced1ae --- /dev/null +++ b/app/services/authorized_project_update/project_access_changed_service.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module AuthorizedProjectUpdate + class ProjectAccessChangedService + def initialize(project_ids) + @project_ids = Array.wrap(project_ids) + end + + def execute(blocking: true) + bulk_args = @project_ids.map { |id| [id] } + + if blocking + AuthorizedProjectUpdate::ProjectRecalculateWorker.bulk_perform_and_wait(bulk_args) + else + AuthorizedProjectUpdate::ProjectRecalculateWorker.bulk_perform_async(bulk_args) # rubocop:disable Scalability/BulkPerformWithContext + end + end + end +end |