Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit baa4d90

Browse files
committed
fix reconnect error handling in EventHistory
1 parent 6c492b4 commit baa4d90

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

contrib/mmts/tests2/lib/bank_client.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,17 @@ def exec_tx(self, name, tx_block):
131131
while self.run.value:
132132
event_id = self.history.register_start(name)
133133

134-
if conn.closed:
135-
self.history.register_finish(event_id, 'ReConnect')
136-
conn = psycopg2.connect(self.connstr)
137-
cur = conn.cursor()
138-
139134
try:
135+
if conn.closed:
136+
conn = psycopg2.connect(self.connstr)
137+
cur = conn.cursor()
138+
self.history.register_finish(event_id, 'ReConnect')
139+
continue
140+
140141
tx_block(conn, cur)
141142
self.history.register_finish(event_id, 'Commit')
142-
except psycopg2.InterfaceError:
143-
self.history.register_finish(event_id, 'InterfaceError')
144-
except psycopg2.Error:
145-
self.history.register_finish(event_id, 'PsycopgError')
143+
except psycopg2.Error as e:
144+
self.history.register_finish(event_id, e.pgerror)
146145

147146
cur.close()
148147
conn.close()

contrib/mmts/tests2/lib/event_history.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def load_queue(self):
4646
# finish mark
4747
if event['event_id'] not in self.running_events:
4848
# found finish event without corresponding start
49+
print(event)
4950
print("ololololo!")
5051
raise
5152

0 commit comments

Comments
 (0)