Migrate Sidekiq workers to ActiveJob
Discussion around motivation for the change: https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/7185
Transform all sidekiq
workers into ActiveJob.
We are aware that there are some performance degradation once we transform a worker into an ActiveJob
but that transformation gives us ability to quickly change the jobs backends in case we want to do that, e.g. from sidekiq
to goodjob
.
Currently we have following Sidekiq workers:
-
ProcessCancelledSubscription
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10258 (worker removal: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10342) -
PromoCodes::Consume
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10260 (worker removal: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10342) -
Salesforce::CreateAccount
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10276 -
Salesforce::CreateLead
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10276 -
Salesforce::CreateOpportunityForUpcomingReconciliation
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10276 -
Salesforce::CreateOpportunity
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10338 -
Salesforce::CreateQuoteForReconciliationWorker
-
Salesforce::FindOrCreateLeadWorker
-
Salesforce::UpdateQSROpportunityStatus
-
SkipReconciliation
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10260 (worker removal: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10342) -
UpdateGitlabPlanInfo
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10374 -
UpdateGitlabUpcomingReconciliations
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10260 (worker removal: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10342) -
UpdateZuoraSubscriptionNamespaceData
- https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/10395 -
Workato::CreateLead
-
ZuoraCallback
-
ZuoraCallout::OrderProcessed
-
ZuoraCallout::SubscriptionTermStart
-
ZuoraCallout::SyncResource::Account
-
ZuoraCallout::SyncResource::Contact
And a bunch of concerns:
IntegrationWorker
LoggableWorker
VerifyGitlabStatus
Migration to ActiveJob
When working on migrating existing Sidekiq workers to ActiveJob
, the following table may be useful:
Sidekiq code... | ...becomes in ActiveJob |
---|---|
Worker.perform_async(*args) |
Job.perform_later(*args) |
Worker.perform_in(5.minutes, *args) |
Job.set(wait: 5.minutes).perform_later(*args) |
More documentation about ActiveJob
here: https://guides.rubyonrails.org/active_job_basics.html#creating-a-job
Edited by Etienne Baqué