From 324d75ec8cf33105591388c4e858bc2de12bf18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 3 Jan 2015 11:37:24 +0100 Subject: [PATCH] Use NOWAIT when locking a table lock is used to enforce a serializable level for all transaction using on the same table. This is not achieved if transactions are waiting for the lock instead of abort and retry with a new transaction because they will still have the initial transaction row values with the repeatable read level. issue4373 review5901002 --- trytond/backend/postgresql/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/backend/postgresql/database.py b/trytond/backend/postgresql/database.py index b476a33344..8c1d650724 100644 --- a/trytond/backend/postgresql/database.py +++ b/trytond/backend/postgresql/database.py @@ -356,7 +356,7 @@ class Cursor(CursorInterface): return self.cursor.fetchone()[0] def lock(self, table): - self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE' % table) + self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE NOWAIT' % table) def has_constraint(self): return True