File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ async def before_first_request():
116116 max_size = app .config .setdefault ('DB_POOL_MAX_SIZE' , 10 ),
117117 ssl = app .config .setdefault ('DB_SSL' ),
118118 loop = asyncio .get_event_loop (),
119+ ** app .config .setdefault ('DB_KWARGS' , dict ()),
119120 )
120121
121122 async def first_or_404 (self , * args , ** kwargs ):
Original file line number Diff line number Diff line change 1818from .models import DB_ARGS , PG_URL
1919
2020pytestmark = pytest .mark .asyncio
21+ _MAX_INACTIVE_CONNECTION_LIFETIME = 59.0
2122
2223
2324# noinspection PyShadowingNames
2425async def _app (config ):
2526 app = Quart (__name__ )
2627 app .config .update (config )
28+ app .config .update ({
29+ 'DB_KWARGS' : dict (
30+ max_inactive_connection_lifetime = _MAX_INACTIVE_CONNECTION_LIFETIME ,
31+ ),
32+ })
2733
2834 db = Gino (app )
2935
@@ -35,6 +41,10 @@ class User(db.Model):
3541
3642 @app .route ('/' )
3743 async def root ():
44+ conn = await request .connection .get_raw_connection ()
45+ # noinspection PyProtectedMember
46+ assert conn ._holder ._max_inactive_time == \
47+ _MAX_INACTIVE_CONNECTION_LIFETIME
3848 return 'Hello, world!'
3949
4050 async def _get_user (ctx , uid : int , method : str ) -> dict :
You can’t perform that action at this time.
0 commit comments