mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
Removing start_initialize_flags because flags are initted in perpetual_check_db_is_up_worker. Logging when flags are initialized.
This commit is contained in:
parent
d0c9bec7f4
commit
a65fa1c6fb
2 changed files with 4 additions and 10 deletions
10
main.py
10
main.py
|
|
@ -269,16 +269,6 @@ async def start_sanic_worker(app: Sanic):
|
|||
await app.dispatch('wrolpi.periodic.check_log_level')
|
||||
|
||||
|
||||
@api_app.listener('after_server_start')
|
||||
async def start_initialize_flags(app: Sanic):
|
||||
# Only allow one child process to initialize flags.
|
||||
if not app.shared_ctx.flags_initialized.is_set():
|
||||
logger.info('start_initialize_flags')
|
||||
app.shared_ctx.flags_initialized.set()
|
||||
async with flags.db_up.wait_for():
|
||||
flags.init_flags()
|
||||
|
||||
|
||||
@api_app.signal('wrolpi.periodic.check_log_level')
|
||||
async def periodic_check_log_level():
|
||||
"""Copies global log level into this Sanic worker's logger."""
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ def init_flags():
|
|||
# Only need to read from once DB at startup.
|
||||
return
|
||||
|
||||
logger.debug('Initializing flags...')
|
||||
|
||||
from wrolpi.db import get_db_session
|
||||
with get_db_session() as session:
|
||||
flags: WROLPiFlag = session.query(WROLPiFlag).one_or_none()
|
||||
|
|
@ -205,6 +207,8 @@ def init_flags():
|
|||
else:
|
||||
outdated_zims.clear()
|
||||
|
||||
logger.debug('Initialized flags')
|
||||
|
||||
|
||||
@contextlib.asynccontextmanager
|
||||
async def wait_for_flag(flag: Flag, timeout: int = 0):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue