Closed fayazkhan closed 10 years ago
This test shows part of the problem
def test_flush_with_transient_nodes_present(self):
transient_node = self.model(ppk=1, parent=None)
self.session.add(transient_node)
try:
self.session.flush()
except IntegrityError:
pass
self.session.rollback()
self.session.add(self.model(ppk=46, parent=None))
self.session.flush()
Can occur in multiple ways in a multithreaded environment with a scoped_session
.
I have not tried to use it with multithreaded environment, thanks for the pull request
Hi, Looking at the code, it seems that
TreesManager.after_flush_postexec
operates on a global_WeakDictBasedSet
object. Maybe it should be single_WeakDictBasedSet
for each session instead?