Class: Gitlab::GithubGistsImport::StartImportWorker
- Inherits:
-
Object
- Object
- Gitlab::GithubGistsImport::StartImportWorker
- Includes:
- ApplicationWorker
- Defined in:
- app/workers/gitlab/github_gists_import/start_import_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Loggable
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
Methods included from SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(user_id, encrypted_token) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/workers/gitlab/github_gists_import/start_import_worker.rb', line 23 def perform(user_id, encrypted_token) logger.info(structured_payload(user_id: user_id, message: 'starting importer')) user = User.find(user_id) decrypted_token = Gitlab::CryptoHelper.aes256_gcm_decrypt(encrypted_token) result = Gitlab::GithubGistsImport::Importer::GistsImporter.new(user, decrypted_token).execute if result.success? schedule_finish_worker(user_id, result.waiter) elsif result.next_attempt_in schedule_next_attempt(result.next_attempt_in, user_id, encrypted_token) else log_error_and_raise!(user_id, result.error) end end |