From 691d109fb746ae1c62a03b3d5e01f718dfe120b9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 30 Oct 2022 11:00:09 +0100 Subject: [PATCH] Expunge entities after session commit to ensure that the ORM objects can be reused --- platypush/entities/_engine.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platypush/entities/_engine.py b/platypush/entities/_engine.py index c258ea09f9..187bab170d 100644 --- a/platypush/entities/_engine.py +++ b/platypush/entities/_engine.py @@ -259,6 +259,9 @@ class EntitiesEngine(Thread): session.add_all(entities) session.commit() + for e in entities: + session.expunge(e) + with self._entities_cache_lock: for entity in entities: self._cache_entities(entity, overwrite_cache=True)