autocommit

This commit is contained in:
ALIHAN DIKEL
2024-10-29 23:34:37 +03:00
parent 2d781a46e7
commit eadb8149ff
3 changed files with 5 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ case "$COMMAND" in
;;
logs)
echo -e "\033[94m[INFO]\033[0m Reading $SERVICE_NAME logs..."
ssh ${REMOTE_USER}@${REMOTE_HOST} "tail -f -n 100 /home/uad/tello-commander/src/server/supervisor/tello-server.out.log"
ssh ${REMOTE_USER}@${REMOTE_HOST} "tail -f -n 100 /home/uad/tello-commander/src/server/supervisor/tello-server.out.log | sed -e 's/ERROR/\x1b[31m&\x1b[0m/g' -e 's/WARN/\x1b[33m&\x1b[0m/g' -e 's/INFO/\x1b[94m&\x1b[0m/g'"
;;
*)
echo -e "\033[31m[ERROR]\033[0m Invalid command!"

View File

@@ -2,6 +2,7 @@ import os
from fastapi import Request, APIRouter
from fastapi.responses import HTMLResponse
from loguru import logger
from starlette.templating import Jinja2Templates
@@ -26,6 +27,7 @@ async def webui(request: Request):
@router.get("/reconnect")
async def reconnect(request: Request):
logger.debug("Reconnecting to tello")
request.app.state.shared_state["connection"] = "NOK"
return {"message": "connection state set to NOK"}

View File

@@ -54,7 +54,7 @@ async def collect_flight_stats(state):
state["command"] = True
# Continuously collect stats and update shared state
if state["connection"] not in ("genesis", "NOK"):
logger.debug(f"Connection state: {state['connection']}")
#logger.debug(f"Connection state: {state['connection']}")
await asyncio.sleep(0.2)
try:
bat = await asyncio.to_thread(tello.get_battery)
@@ -67,7 +67,7 @@ async def collect_flight_stats(state):
logger.error(te)
# search for any response if disconnected
else:
if counter % 10 == 0:
if counter % 30 == 0:
logger.warning("skipping stats collection")
counter += 1
await asyncio.sleep(1)