From 6bf7f7525e78224e0e3a49f77714f70158d8f308 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Wed, 11 Oct 2023 01:45:17 +0200 Subject: [PATCH] Async shit --- src/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index 0d77cd5..3922930 100644 --- a/src/main.py +++ b/src/main.py @@ -36,7 +36,7 @@ async def start_time_loop(): async def turn_off(): global should_run_time_loop should_run_time_loop = False - matrix_display.turn_off() + asyncio.create_task(lambda: matrix_display.turn_off()) return {"message": "Display turned off"} @@ -44,7 +44,7 @@ async def turn_off(): async def flash(count: int = 1): global should_run_time_loop should_run_time_loop = False - matrix_display.flash(count) + asyncio.create_task(lambda: matrix_display.flash(count)) return {"message": "Display flashed"} @@ -54,7 +54,7 @@ async def display_message(body: dict): should_run_time_loop = False message_text = body.get("message") try: - matrix_display.show_text(message_text) + asyncio.create_task(lambda: matrix_display.show_text(message_text)) except requests.exceptions.RequestException as e: raise HTTPException( status_code=500,