From bb55d02210274fcdabba0e3a08f0291c995ed742 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Tue, 10 Jul 2018 22:39:16 +0300 Subject: [PATCH] operational error handling in poll_query_until() --- testgres/connection.py | 1 + testgres/node.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/testgres/connection.py b/testgres/connection.py index 3943a4e2..b6d341e5 100644 --- a/testgres/connection.py +++ b/testgres/connection.py @@ -20,6 +20,7 @@ # export these exceptions InternalError = pglib.InternalError ProgrammingError = pglib.ProgrammingError +OperationalError = pglib.OperationalError class NodeConnection(object): diff --git a/testgres/node.py b/testgres/node.py index b171d965..39a706f0 100644 --- a/testgres/node.py +++ b/testgres/node.py @@ -22,7 +22,8 @@ from .connection import \ NodeConnection, \ InternalError, \ - ProgrammingError + ProgrammingError, \ + OperationalError from .consts import \ DATA_DIR, \ @@ -981,7 +982,8 @@ def poll_query_until(self, expected=True, commit=True, raise_programming_error=True, - raise_internal_error=True): + raise_internal_error=True, + raise_operational_error=True): """ Run a query once per second until it returns 'expected'. Query should return a single value (1 row, 1 column). @@ -1040,6 +1042,10 @@ def poll_query_until(self, if raise_internal_error: raise e + except OperationalError as e: + if raise_operational_error: + raise e + time.sleep(sleep_time) attempts += 1 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy