@@ -43,7 +43,7 @@ class DataSourceName:
43
43
user : str
44
44
password : str = attr .ib (repr = False )
45
45
database : str
46
- host : str = "localhost "
46
+ host : str = "127.0.0.1 "
47
47
port : int = 5432
48
48
49
49
# Attributes about the caller
@@ -60,14 +60,14 @@ def to_uri(self, with_query=False) -> str:
60
60
61
61
62
62
def create_pg_engine (dsn : DataSourceName , minsize : int = 1 , maxsize : int = 4 ):
63
- """ Adapts the arguments of aiopg.sa.create_engine
63
+ """Adapts the arguments of aiopg.sa.create_engine
64
64
65
- Returns a coroutine that is awaitable, i.e.
65
+ Returns a coroutine that is awaitable, i.e.
66
66
67
- async with create_pg_engine as engine:
68
- assert not engine.closed
67
+ async with create_pg_engine as engine:
68
+ assert not engine.closed
69
69
70
- assert engine.closed
70
+ assert engine.closed
71
71
"""
72
72
awaitable_engine_coro = create_engine (
73
73
dsn .to_uri (),
@@ -154,8 +154,7 @@ def raise_http_unavailable_error(retry_state: RetryCallState):
154
154
155
155
156
156
class PostgresRetryPolicyUponInitialization :
157
- """ Retry policy upon service initialization
158
- """
157
+ """Retry policy upon service initialization"""
159
158
160
159
WAIT_SECS = 5
161
160
ATTEMPTS_COUNT = 20
@@ -172,8 +171,7 @@ def __init__(self, logger: Optional[logging.Logger] = None):
172
171
173
172
174
173
class PostgresRetryPolicyUponOperation :
175
- """ Retry policy upon service operation
176
- """
174
+ """Retry policy upon service operation"""
177
175
178
176
WAIT_SECS = 2
179
177
ATTEMPTS_COUNT = 3
@@ -195,8 +193,8 @@ def __init__(self, logger: Optional[logging.Logger] = None):
195
193
196
194
197
195
def retry_pg_api (func ):
198
- """ Decorator to implement postgres service retry policy and
199
- keep global statistics on service attempt fails
196
+ """Decorator to implement postgres service retry policy and
197
+ keep global statistics on service attempt fails
200
198
"""
201
199
# TODO: temporary. For the time being, use instead postgres_service_retry_policy_kwargs
202
200
_deco_func = retry (** postgres_service_retry_policy_kwargs )(func )
0 commit comments