summaryrefslogtreecommitdiff
path: root/app/services/ci/update_build_queue_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/ci/update_build_queue_service.rb')
-rw-r--r--app/services/ci/update_build_queue_service.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/app/services/ci/update_build_queue_service.rb b/app/services/ci/update_build_queue_service.rb
index 5a011a8cac6..a525ea179e0 100644
--- a/app/services/ci/update_build_queue_service.rb
+++ b/app/services/ci/update_build_queue_service.rb
@@ -37,14 +37,19 @@ module Ci
raise InvalidQueueTransition unless transition.from == 'pending'
- transition.within_transaction do
- removed = build.all_queuing_entries.delete_all
+ transition.within_transaction { remove!(build) }
+ end
- if removed > 0
- metrics.increment_queue_operation(:build_queue_pop)
+ ##
+ # Force recemove build from the queue, without checking a transition state
+ #
+ def remove!(build)
+ removed = build.all_queuing_entries.delete_all
- build.id
- end
+ if removed > 0
+ metrics.increment_queue_operation(:build_queue_pop)
+
+ build.id
end
end