This commit is contained in:
2019-12-13 16:42:10 +01:00
parent a7934e37d7
commit eccc5c4098
42 changed files with 211 additions and 246 deletions

View File

@ -97,7 +97,10 @@ class CallDispatcher:
risotto_context.function = function_obj['function']
if function_obj['risotto_context']:
kw['risotto_context'] = risotto_context
if function_obj['database']:
# do not start a new database connection
if function_obj['database'] and hasattr(old_risotto_context, 'connection'):
risotto_context.connection = old_risotto_context.connection
if function_obj['database'] and not hasattr(risotto_context, 'connection'):
db_conf = get_config().get('database')
pool = await asyncpg.create_pool(database=db_conf.get('dbname'), user=db_conf.get('user'))
async with pool.acquire() as connection: