1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-14 10:53:30 +02:00

Added tenacity retry fir migrations connection

This commit is contained in:
Ionut Filip 2018-12-03 15:25:10 +02:00
parent bdcf69b0e6
commit 7b8835070d
3 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,8 @@ from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import logging
import tenacity
from tenacity import retry
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@ -68,8 +70,8 @@ def run_migrations_online():
engine = engine_from_config(config.get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)
connection = retry(engine.connect, stop=tenacity.stop_after_attempt(100), wait=tenacity.wait_random(min=2, max=5))()
connection = engine.connect()
context.configure(connection=connection,
target_metadata=target_metadata,
process_revision_directives=process_revision_directives,

View File

@ -46,3 +46,4 @@ WTForms==2.2.1
WTForms-Components==0.10.3
psycopg2
sqlalchemy-citext
tenacity

View File

@ -17,3 +17,4 @@ PyYAML
PyOpenSSL
dnspython
bcrypt
tenacity