Skip to content

Fix Bitbucket Server Importer enqueued job count

What does this MR do and why?

When BitbucketServerImport::Stage::PullRequestsWorker and BitbucketServerImport::Stage::ImportNotesWorker job are retried, the jobs_remaining counter is incorrectly incremented for both processed and unprocessed pull requests and comments, leading to inaccurate job counts.

This fix ensures jobs_remaining is only incremented for records that haven't been processed yet, preventing the miscount during retries and prevents stage workers from not progressing

References

#555098 (closed)

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Follow the Import and Integration guide to set up a local Bitbucket Server instance.
  2. In the Bitbucket Server instance, create a repo and a PR with comments.
  3. In GitLab:
    1. Visit /admin/application_settings/network and enable local requests.
    2. Visit /projects/new#import_project.
    3. Choose Bitbucket Server.
    4. Enter your server details, and click List your Bitbucket Server repositories.
    5. Next to one of your BitBucket repositories, click Import.
  4. During the import of activities (notes), stop Sidekiq
  5. Restart Sidekiq
  6. The migration should finish successfully

MR 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.

Edited by Rodrigo Tomonari

Merge request reports

Loading