fix: tighten ledger skip CLI auditing

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-08-24 13:42:47 +00:00
committed by GitHub
co-authored by genichin
parent 48dfc3e76f
commit 169f222042
3 changed files with 84 additions and 9 deletions
@@ -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,),