From d28eafab2992ab63688edf9fdaee8f13e2902f6a Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Fri, 19 Jul 2019 00:32:14 -0400 Subject: [PATCH] Adds comment writer to conf --- src/app.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app.py b/src/app.py index bcaa783..e173189 100644 --- a/src/app.py +++ b/src/app.py @@ -3,6 +3,7 @@ import logging import pathlib import re +import aiojobs import aiojobs.aiohttp import asyncio from aiohttp import web @@ -10,7 +11,6 @@ from aiohttp import web import schema.db_helpers from src.database import obtain_connection, DatabaseWriter from src.handles import api_endpoint -from src.handles import create_comment_scheduler from src.settings import config_path, get_config config = get_config(config_path) @@ -60,11 +60,13 @@ async def database_backup_routine(app): pass +# noinspection PyDeprecation async def start_background_tasks(app: web.Application): app['reader'] = obtain_connection(app['db_path'], True) app['waitful_backup'] = app.loop.create_task(database_backup_routine(app)) - app['comment_scheduler'] = await create_comment_scheduler() - app['writer'] = DatabaseWriter(app['db_path']) + app['comment_scheduler'] = await aiojobs.create_scheduler(limit=1, pending_limit=0) + app['db_writer'] = DatabaseWriter(app['db_path']) + app['writer'] = app['db_writer'].connection def insert_to_config(app, conf=None, db_file=None):