From 2fe67815c65e07953bdb435f417e1fcf2e02d1d4 Mon Sep 17 00:00:00 2001 From: n9k Date: Sun, 24 Jul 2022 05:40:43 +0000 Subject: [PATCH] Fix control socket & event socket (?) For some reason this commit seems to make the control and event sockets work where previously they would sometimes (but ONLY sometimes) refuse to connect. --- anonstream/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/anonstream/__init__.py b/anonstream/__init__.py index 28e3060..575073f 100644 --- a/anonstream/__init__.py +++ b/anonstream/__init__.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 2022 n9k # SPDX-License-Identifier: AGPL-3.0-or-later +import asyncio import json from collections import OrderedDict @@ -76,6 +77,10 @@ def create_app(toml_config): @app.before_serving async def startup(): + # Create routes and background tasks + import anonstream.routes + import anonstream.tasks + # Start control server if app.config['SOCKET_CONTROL_ENABLED']: from anonstream.control.server import start_control_server_at @@ -94,8 +99,4 @@ def create_app(toml_config): ) app.add_background_task(start_event_server) - # Create routes and background tasks - import anonstream.routes - import anonstream.tasks - return app