Don't query for baseline results we won't use.

britney currently spends a majority of its runtime querying for baseline
test results that it won't find, and that it doesn't need.  Refactor to
eliminate many of these excess queries.
This commit is contained in:
Steve Langasek 2022-08-23 13:46:41 -07:00
parent 0998eeaa1a
commit 479662c63e

@ -1168,11 +1168,12 @@ class AutopkgtestPolicy(BasePolicy):
if has_result: if has_result:
result_state = result[0] result_state = result[0]
version = result[1] version = result[1]
baseline = self.result_in_baseline(src, arch)
if result_state in {Result.OLD_PASS, Result.OLD_FAIL, Result.OLD_NEUTRAL}: if result_state in {Result.OLD_PASS, Result.OLD_FAIL, Result.OLD_NEUTRAL}:
pass pass
elif result_state == Result.FAIL and \ elif result_state == Result.FAIL and \
baseline[0] in {Result.PASS, Result.NEUTRAL, Result.OLD_PASS, Result.OLD_NEUTRAL} and \ self.result_in_baseline(src, arch)[0] in \
{Result.PASS, Result.NEUTRAL, Result.OLD_PASS,
Result.OLD_NEUTRAL} and \
self.options.adt_retry_older_than and \ self.options.adt_retry_older_than and \
result[3] + int(self.options.adt_retry_older_than) * SECPERDAY < self._now: result[3] + int(self.options.adt_retry_older_than) * SECPERDAY < self._now:
# We might want to retry this failure, so continue # We might want to retry this failure, so continue