fix postgres serializable transaction
This commit is contained in:
parent
7f5b431364
commit
0a70ea8a95
@ -13,7 +13,7 @@ class DBModel:
|
|||||||
def __init__(self, connection, cursor):
|
def __init__(self, connection, cursor):
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
self.cursor = cursor
|
self.cursor = cursor
|
||||||
self.cursor.execute("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;")
|
#self.cursor.execute("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;")
|
||||||
|
|
||||||
|
|
||||||
# ------ LOGIN ---------
|
# ------ LOGIN ---------
|
||||||
@ -362,7 +362,7 @@ class DBModel:
|
|||||||
# have to make a new cursor to set isolation level
|
# have to make a new cursor to set isolation level
|
||||||
# cursor = self.connection.cursor()
|
# cursor = self.connection.cursor()
|
||||||
self.cursor.execute("""
|
self.cursor.execute("""
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||||
UPDATE host_operation SET assignment_status = 'assigned'
|
UPDATE host_operation SET assignment_status = 'assigned'
|
||||||
WHERE host = %s AND operation = %s AND operation != (
|
WHERE host = %s AND operation = %s AND operation != (
|
||||||
SELECT COALESCE(
|
SELECT COALESCE(
|
||||||
|
Loading…
Reference in New Issue
Block a user