fix a separate race case

In a very close race, one side can first see the duplicate nvr
during the get_build check in new_build, which leads to an
attempt to recycle, which fails because the duplicate is in the
BUILDING state.
This commit is contained in:
Mike McLean 2025-06-26 00:18:52 -04:00
parent bf27153e1e
commit ecfa7766b5

View file

@ -4861,8 +4861,9 @@ def get_next_build(build_info):
for try_no in range(2, 10):
savepoint = Savepoint('get_next_build_pre_insert')
try:
return new_build(build_info)
except IntegrityError:
# using strict so we don't try to recycle
return new_build(build_info, strict=True)
except (IntegrityError, koji.GenericError):
savepoint.rollback()
build_info['release'] = get_next_release(build_info, try_no)
# otherwise