Skip to content

Maintain correlation_id across Sidekiq retries

Dylan Griffith requested to merge maintain-correlation-id-in-sidekiq-retry into master

Previously this code was overriding the correlation_id in the job hash. That's because retries were generating a new context and this new context had a new random correlation_id.

Now we take the previous correlation_id into account when generating a new context.

How to test

  1. Add a raise 'foobar' to any worker
  2. Watch the logs in gdk tail rails-background-jobs
  3. Call a perform_async from the rails console for that sidekiq worker
  4. Wait a minute for it to retry
  5. See whether the correlation_id matches for the retry jobs and the original job

Without this patch you should see that they are different. With this patch they should match. I have tested this locally.

Closes gitlab-org/gitlab#440700 (closed)

Edited by Dylan Griffith

Merge request reports