mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-06-14 22:17:34 +08:00
Move ComponentBuildTrace creation from before_commit to before_flush
Since ComponentBuildTrace(s) get created with db_session.commit() call, is is not possible to commit more items in bulk if they already have been flushed. Current unit-tests' setup can be significantly sped up if items can be quickly flushed on the fly and bulk-commited only once at the end. Moreover in general it seems more appropriate/safer to handle this in before_flush as any implicit or accidental flush could cause new build traces not to be created at all. As flush is implicitly called before every commit anyway, this change shouldn't pose any harm.
This commit is contained in:
@@ -1302,7 +1302,7 @@ class LogMessage(MBSBase):
|
||||
)
|
||||
|
||||
|
||||
def session_before_commit_handlers(session):
|
||||
def session_before_flush_handlers(session, flush_context, instances):
|
||||
# new and updated items
|
||||
for item in set(session.new) | set(session.dirty):
|
||||
# handlers for component builds
|
||||
|
||||
Reference in New Issue
Block a user