debian-mirror-gitlab/app/workers/authorized_projects_worker.rb

22 lines
552 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
class AuthorizedProjectsWorker
include Sidekiq::Worker
include DedicatedSidekiqQueue
# Schedules multiple jobs and waits for them to be completed.
def self.bulk_perform_and_wait(args_list)
job_ids = bulk_perform_async(args_list)
Gitlab::JobWaiter.new(job_ids).wait
end
def self.bulk_perform_async(args_list)
Sidekiq::Client.push_bulk('class' => self, 'queue' => sidekiq_options['queue'], 'args' => args_list)
end
def perform(user_id)
user = User.find_by(id: user_id)
user&.refresh_authorized_projects
end
end