diff options
Diffstat (limited to 'app/services/user_project_access_changed_service.rb')
-rw-r--r-- | app/services/user_project_access_changed_service.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/services/user_project_access_changed_service.rb b/app/services/user_project_access_changed_service.rb index 5bba986f4ad..ceaf21bb926 100644 --- a/app/services/user_project_access_changed_service.rb +++ b/app/services/user_project_access_changed_service.rb @@ -2,8 +2,10 @@ class UserProjectAccessChangedService DELAY = 1.hour + MEDIUM_DELAY = 10.minutes HIGH_PRIORITY = :high + MEDIUM_PRIORITY = :medium LOW_PRIORITY = :low def initialize(user_ids) @@ -11,6 +13,8 @@ class UserProjectAccessChangedService end def execute(blocking: true, priority: HIGH_PRIORITY) + return if @user_ids.empty? + bulk_args = @user_ids.map { |id| [id] } result = @@ -19,6 +23,8 @@ class UserProjectAccessChangedService else if priority == HIGH_PRIORITY AuthorizedProjectsWorker.bulk_perform_async(bulk_args) # rubocop:disable Scalability/BulkPerformWithContext + elsif priority == MEDIUM_PRIORITY + AuthorizedProjectUpdate::UserRefreshWithLowUrgencyWorker.bulk_perform_in(MEDIUM_DELAY, bulk_args, batch_size: 100, batch_delay: 30.seconds) # rubocop:disable Scalability/BulkPerformWithContext else with_related_class_context do # We wrap the execution in `with_related_class_context`so as to obtain |