Retry on operation error when connecting to the database
When there is no pooled connection available, `.getconn()` tries to connect to the database. This connection may raise an OperationalError like this: ``` Traceback (most recent call last): File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 117, in dispatch_request return endpoint(request, **requestview_args) File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 47, in rpc request, database_name, *requestrpc_params) File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 84, in auth_required return wrapped(*args, **kwargs) File "/usr/local/lib/python37/dist-packages/trytond/protocols/wrapperspy", line 181, in wrapper return func(request, pool, *args, **kwargs) File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 172, in _dispatch readonly=rpcreadonly) as transaction: File "/usr/local/lib/python37/dist-packages/trytond/transactionpy", line 110, in start autocommit=autocommit) File "/usr/local/lib/python37/dist-packages/trytond/backend/postgresql/databasepy", line 263, in get_connection conn = self_connpoolgetconn() File "/psycopg2/poolpy", line 168, in getconn return self_getconn(key) File "/psycopg2/poolpy", line 92, in _getconn return self_connect(key) File "/psycopg2/poolpy", line 62, in _connect conn = psycopg2connect(*self_args, **self_kwargs) File "/psycopg2/__init__py", line 130, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request ```
issue