Reschedule Helm metadata cache rebuilds skipped during a running rebuild
What does this MR do and why?
Reschedule Helm metadata cache rebuilds skipped during a running rebuild
Packages::Helm::CreateMetadataCacheWorker used until_executing
deduplication, so a new job could start while a rebuild for the same
project and channel was still running. That job then failed to obtain
the exclusive lease in CreateMetadataCacheService and exited without
retrying. When this happened to the last upload of a burst, the cached
index.yaml never included that chart.
Switch to until_executed with if_deduplicated: :reschedule_once so
uploads during a running rebuild trigger one more rebuild after it
finishes.
Changelog: fixed
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
References
- Issue: #631765 (closed)
- Sidekiq deduplication docs: https://docs.gitlab.com/development/sidekiq/idempotent_jobs/#until-executed
reschedule_onceoption: #342123 (closed)
Screenshots or screen recordings
Not applicable — background worker change with no UI impact.
How to set up and validate locally
The race condition cannot be reliably reproduced by hand in GDK: a Helm index rebuild over a small number of charts finishes in milliseconds, so no second upload lands while a rebuild is still running. The unit tests are the primary guard for this change.
Confirm the deduplication strategy in a Rails console:
Packages::Helm::CreateMetadataCacheWorker.get_deduplicate_strategy
# => :until_executed
Packages::Helm::CreateMetadataCacheWorker.get_deduplication_options
# => { if_deduplicated: :reschedule_once }Run the unit tests:
bundle exec rspec spec/workers/packages/helm/create_metadata_cache_worker_spec.rbMR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.