Expunge entities after session commit to ensure that the ORM objects can be reused

This commit is contained in:
Fabio Manganiello 2022-10-30 11:00:09 +01:00
parent 71ccf6d04a
commit 691d109fb7
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -259,6 +259,9 @@ class EntitiesEngine(Thread):
session.add_all(entities) session.add_all(entities)
session.commit() session.commit()
for e in entities:
session.expunge(e)
with self._entities_cache_lock: with self._entities_cache_lock:
for entity in entities: for entity in entities:
self._cache_entities(entity, overwrite_cache=True) self._cache_entities(entity, overwrite_cache=True)