BigW Consortium Gitlab

authorized_projects_worker.rb 552 Bytes
Newer Older
1 2 3 4
class AuthorizedProjectsWorker
  include Sidekiq::Worker
  include DedicatedSidekiqQueue

5 6 7 8 9 10 11
  # 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

12
  def self.bulk_perform_async(args_list)
13
    Sidekiq::Client.push_bulk('class' => self, 'queue' => sidekiq_options['queue'], 'args' => args_list)
14 15 16 17 18
  end

  def perform(user_id)
    user = User.find_by(id: user_id)

19
    user&.refresh_authorized_projects
20 21
  end
end