fix: tighten ledger skip CLI auditing
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
48dfc3e76f
commit
169f222042
@@ -41,8 +41,8 @@ class PostgreSQLLedgerSkipStore:
|
||||
now = datetime.now(tz=UTC)
|
||||
notify = False
|
||||
for _ in range(2):
|
||||
with self._psycopg.connect(self._dsn, autocommit=False) as conn, conn.cursor() as cur:
|
||||
try:
|
||||
try:
|
||||
with self._psycopg.connect(self._dsn, autocommit=False) as conn, conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"INSERT INTO ledger_skip "
|
||||
"(skip_key, instance_key, slot_id, portfolio_id, symbol, order_id, "
|
||||
@@ -72,8 +72,8 @@ class PostgreSQLLedgerSkipStore:
|
||||
conn.commit()
|
||||
notify = True
|
||||
break
|
||||
except self._psycopg.errors.UniqueViolation:
|
||||
conn.rollback()
|
||||
except self._psycopg.errors.UniqueViolation:
|
||||
with self._psycopg.connect(self._dsn, autocommit=False) as conn, conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"SELECT status FROM ledger_skip WHERE skip_key = %s FOR UPDATE",
|
||||
(skip_key,),
|
||||
|
||||
Reference in New Issue
Block a user