Allow interrupted RelationBatchExportWorker to bypass limit

What does this MR do and why?

In !169122 (merged), a limit was established to restrict the number of concurrent RelationBatchExportWorker jobs. However, when jobs are interrupted, they are only retried after being classified as timed out, which can take a considerable amount of time.

This change updates the limit to be bypassed when the batch is already in a started state, allowing interrupted jobs to be retried immediately.

References

Please include cross links to any resources that are relevant to this MR This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

#473224 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Reduce the concurrent_relation_batch_export_limit limit:
curl --request PUT \
	--url http://gdk.test:3000/api/v4/application/settings \
	--header 'Content-Type: application/json' \
	--header 'PRIVATE-TOKEN: <PRIVATE_TOKEN>' \
	--data '{
	"concurrent_relation_batch_export_limit": 2
}'
  1. Export a project that has many issues or MRs using the following API request
curl --location 'http://gdk.test:3000/api/v4/projects/ID/export_relations' \
--header 'PRIVATE-TOKEN: <PRIVATE_TOKEN>' \
--form 'batched="true"'
  1. Using Sidekiq Dashboard, check if a RelationBatchExportWorker is running.

  2. Gracefully stop Sidekiq gdk stop rails-background-jobs

  3. Restart Sidekiq gdk start rails-background-jobs

  4. Check if relation exports finish in a reasonable amount of time

curl --location 'http://gdk.test:3000/api/v4/projects/ID/export_relations/status' \
--header 'PRIVATE-TOKEN: <PRIVATE_TOKEN>'
Edited by Rodrigo Tomonari

Merge request reports

Loading