Fix build queue removal during database replication lag

What does this MR do and why?

Prevent builds from being removed from the queue when the replica database has not caught up with the primary. Previously, builds could be incorrectly removed when they appeared non-pending on the replica but were still pending on the primary, causing them to be lost.

References

Relates to https://gitlab.com/gitlab-com/request-for-help/-/issues/3690

How to set up and validate locally

I'm trying to test this with a delayed PostgreSQL replica.

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 Stan Hu

Merge request reports

Loading