mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-23 18:21:42 +08:00
Module builds now remember what module they reused for building.
There was a race condition, when 2 builds where build in the same time. There was an issue that after one has finished the other reused the new build for reuse and not the one it started with. Ticket-ID: FACTORY-3862 Signed-off-by: Martin Curlej <mcurlej@redhat.com>
This commit is contained in:
@@ -85,8 +85,11 @@ def get_reusable_module(session, module):
|
||||
:param module: the ModuleBuild object of module being built.
|
||||
:return: ModuleBuild object which can be used for component reuse.
|
||||
"""
|
||||
mmd = module.mmd()
|
||||
|
||||
if module.reused_module:
|
||||
return module.reused_module
|
||||
|
||||
mmd = module.mmd()
|
||||
# Find the latest module that is in the done or ready state
|
||||
previous_module_build = (
|
||||
session.query(models.ModuleBuild)
|
||||
@@ -111,6 +114,9 @@ def get_reusable_module(session, module):
|
||||
log.info("Cannot re-use. %r is the first module build." % module)
|
||||
return None
|
||||
|
||||
module.reused_module_id = previous_module_build.id
|
||||
session.commit()
|
||||
|
||||
return previous_module_build
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user