fix postgres serializable transaction

This commit is contained in:
forest 2021-03-21 12:16:17 -05:00
parent 7f5b431364
commit 0a70ea8a95

View File

@ -13,7 +13,7 @@ class DBModel:
def __init__(self, connection, cursor):
self.connection = connection
self.cursor = cursor
self.cursor.execute("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;")
#self.cursor.execute("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;")
# ------ LOGIN ---------
@ -362,7 +362,7 @@ class DBModel:
# have to make a new cursor to set isolation level
# cursor = self.connection.cursor()
self.cursor.execute("""
BEGIN TRANSACTION;
BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
UPDATE host_operation SET assignment_status = 'assigned'
WHERE host = %s AND operation = %s AND operation != (
SELECT COALESCE(