diff options
Diffstat (limited to 'app/workers/authorized_project_update/project_recalculate_per_user_worker.rb')
-rw-r--r-- | app/workers/authorized_project_update/project_recalculate_per_user_worker.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/workers/authorized_project_update/project_recalculate_per_user_worker.rb b/app/workers/authorized_project_update/project_recalculate_per_user_worker.rb new file mode 100644 index 00000000000..352c82e5021 --- /dev/null +++ b/app/workers/authorized_project_update/project_recalculate_per_user_worker.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module AuthorizedProjectUpdate + class ProjectRecalculatePerUserWorker < ProjectRecalculateWorker + data_consistency :always + + feature_category :authentication_and_authorization + urgency :high + queue_namespace :authorized_project_update + + deduplicate :until_executing, including_scheduled: true + idempotent! + + def perform(project_id, user_id) + project = Project.find_by_id(project_id) + user = User.find_by_id(user_id) + + return unless project && user + + in_lock(lock_key(project), ttl: 10.seconds) do + AuthorizedProjectUpdate::ProjectRecalculatePerUserService.new(project, user).execute + end + end + end +end |