Improv
This commit is contained in:
parent
e4f88110fd
commit
08cb3b9588
1 changed files with 5 additions and 0 deletions
|
@ -62,6 +62,7 @@ async def flash(count: int = 1):
|
||||||
@app.post("/message")
|
@app.post("/message")
|
||||||
async def display_message(body: dict):
|
async def display_message(body: dict):
|
||||||
global should_run_time_loop
|
global should_run_time_loop
|
||||||
|
was_clock_runnign = should_run_time_loop
|
||||||
should_run_time_loop = False
|
should_run_time_loop = False
|
||||||
message_text = body.get("message")
|
message_text = body.get("message")
|
||||||
try:
|
try:
|
||||||
|
@ -71,6 +72,10 @@ async def display_message(body: dict):
|
||||||
status_code=500,
|
status_code=500,
|
||||||
detail=f"Failed to display message on the matrix display: {e}",
|
detail=f"Failed to display message on the matrix display: {e}",
|
||||||
)
|
)
|
||||||
|
finally:
|
||||||
|
if was_clock_runnign:
|
||||||
|
should_run_time_loop = True
|
||||||
|
asyncio.create_task(display_time())
|
||||||
return {"message": "Message displayed"}
|
return {"message": "Message displayed"}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue