Move isChangeReadyToBeEnqueued after pipeline requirements

When adding a change to a pipeline we have two filter steps before
getting the change queue and doing further checks. The first one calls
isChangeReadyToBeEnqueued which is used by the dependent pipeline
manager to check if a change can merge. This causes potentially
various api calls as this updates the change, analyzes status checks
etc and thus is potentially expensive. The check for pipeline
requirements is purely local and thus cheap. In many cases the
pipeline requirements could filter out changes before the can merge
check.

Switching these two filters can save us some api calls and improve the
performance of the scheduler run_handler loop.

Change-Id: I3d3ea186e7852ae9c253d29f78dd5d7df81e71aa
This commit is contained in:
Tobias Henkel 2019-01-31 10:53:45 +01:00
parent 363d881ab9
commit e207432a41
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 5 additions and 5 deletions

View File

@ -277,11 +277,6 @@ class PipelineManager(object):
"ignoring" % change)
return True
if not self.isChangeReadyToBeEnqueued(change):
self.log.debug("Change %s is not ready to be enqueued, ignoring" %
change)
return False
if not ignore_requirements:
for f in self.ref_filters:
if f.connection_name != change.project.connection_name:
@ -293,6 +288,11 @@ class PipelineManager(object):
"requirement %s" % (change, f))
return False
if not self.isChangeReadyToBeEnqueued(change):
self.log.debug("Change %s is not ready to be enqueued, ignoring" %
change)
return False
with self.getChangeQueue(change, change_queue) as change_queue:
if not change_queue:
self.log.debug("Unable to find change queue for "