diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-21 15:11:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-21 15:11:29 +0300 |
commit | 559b1da28e46a9969315beb11ee2d2056f75b06d (patch) | |
tree | fad20c706047f4aca44c1f030cb81d5b1e302cab /doc/development | |
parent | a065770457b66dc856897fc5282bf897b9e4f65b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development')
-rw-r--r-- | doc/development/sidekiq/index.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/development/sidekiq/index.md b/doc/development/sidekiq/index.md index e8c939571cf..a95e94cdd34 100644 --- a/doc/development/sidekiq/index.md +++ b/doc/development/sidekiq/index.md @@ -36,6 +36,31 @@ with back-off between each retry. 25 retries means that the last retry would happen around three weeks after the first attempt (assuming all 24 prior retries failed). +This means that a lot can happen in between the job being scheduled +and its execution. Therefore, we must guard workers so they don't +fail 25 times when the state changes after they are scheduled. For +example, a job should not fail when the project it was scheduled for +is deleted. + +Instead of: + +```ruby +def perform(project_id) + project = Project.find(project_id) + # ... +end +``` + +Do this: + +```ruby +def perform(project_id) + project = Project.find_by_id(project_id) + return unless project + # ... +end +``` + For most workers - especially [idempotent workers](idempotent_jobs.md) - the default of 25 retries is more than sufficient. Many of our older workers declare 3 retries, which used to be the default within the |