sql: do not try rollbacking if there's no connection anymore (#49622) #509
|
@ -384,8 +384,10 @@ def guard_postgres(func):
|
|||
try:
|
||||
return func(*args, **kwargs)
|
||||
except psycopg2.Error:
|
||||
get_publisher().capture_exception(sys.exc_info())
|
||||
get_connection().rollback()
|
||||
conn = get_connection()
|
||||
if conn:
|
||||
get_publisher().capture_exception(sys.exc_info())
|
||||
conn.rollback()
|
||||
raise
|
||||
|
||||
return f
|
||||
|
|
Loading…
Reference in New Issue