Adds comment writer to conf
This commit is contained in:
parent
b24b91fa85
commit
d28eafab29
1 changed files with 5 additions and 3 deletions
|
@ -3,6 +3,7 @@ import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
import aiojobs
|
||||||
import aiojobs.aiohttp
|
import aiojobs.aiohttp
|
||||||
import asyncio
|
import asyncio
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
@ -10,7 +11,6 @@ from aiohttp import web
|
||||||
import schema.db_helpers
|
import schema.db_helpers
|
||||||
from src.database import obtain_connection, DatabaseWriter
|
from src.database import obtain_connection, DatabaseWriter
|
||||||
from src.handles import api_endpoint
|
from src.handles import api_endpoint
|
||||||
from src.handles import create_comment_scheduler
|
|
||||||
from src.settings import config_path, get_config
|
from src.settings import config_path, get_config
|
||||||
|
|
||||||
config = get_config(config_path)
|
config = get_config(config_path)
|
||||||
|
@ -60,11 +60,13 @@ async def database_backup_routine(app):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyDeprecation
|
||||||
async def start_background_tasks(app: web.Application):
|
async def start_background_tasks(app: web.Application):
|
||||||
app['reader'] = obtain_connection(app['db_path'], True)
|
app['reader'] = obtain_connection(app['db_path'], True)
|
||||||
app['waitful_backup'] = app.loop.create_task(database_backup_routine(app))
|
app['waitful_backup'] = app.loop.create_task(database_backup_routine(app))
|
||||||
app['comment_scheduler'] = await create_comment_scheduler()
|
app['comment_scheduler'] = await aiojobs.create_scheduler(limit=1, pending_limit=0)
|
||||||
app['writer'] = DatabaseWriter(app['db_path'])
|
app['db_writer'] = DatabaseWriter(app['db_path'])
|
||||||
|
app['writer'] = app['db_writer'].connection
|
||||||
|
|
||||||
|
|
||||||
def insert_to_config(app, conf=None, db_file=None):
|
def insert_to_config(app, conf=None, db_file=None):
|
||||||
|
|
Loading…
Reference in a new issue