Class: Gitlab::GithubGistsImport::FinishImportWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker
Defined in:
app/workers/gitlab/github_gists_import/finish_import_worker.rb

Constant Summary collapse

INTERVAL =
30.seconds.to_i
BLOCKING_WAIT_TIME =
5
GISTS_ERRORS_BY_ID =
'gitlab:github-gists-import:%{user_id}:errors'

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from Loggable

Loggable::ANONYMOUS

Constants included from WorkerAttributes

WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Loggable

#build_structured_payload

Methods included from SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(user_id, waiter_key, remaining) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'app/workers/gitlab/github_gists_import/finish_import_worker.rb', line 23

def perform(user_id, waiter_key, remaining)
  waiter = wait_for_jobs(waiter_key, remaining)

  if waiter.nil?
    Gitlab::GithubGistsImport::Status.new(user_id).finish!
    Gitlab::GithubImport::Logger.info(user_id: user_id, message: 'GitHub Gists import finished')
    send_email_if_errors(user_id)
  else
    self.class.perform_in(INTERVAL, user_id, waiter.key, waiter.jobs_remaining)
  end
end