fix:
--FIXED WEB SOCKET ISSUE
This commit is contained in:
1 parent
1c7e7cc886
commit
e34b3c7445
2 files changed
+34
-4
No files matched your search
+30
@@ -0,0 +1,30 @@
|
|||||||
|
# Virtual environment
|
||||||
|
venv/
|
||||||
|
.venv/
|
||||||
|
|
||||||
|
# Python cache
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
|
||||||
|
# Environment variables / secrets
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
|
||||||
|
# IDE / editor files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Python tooling caches
|
||||||
|
.pytest_cache/
|
||||||
|
.mypy_cache/
|
||||||
|
|
||||||
|
# Build / packaging
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import psutil
|
import psutil
|
||||||
from fastapi import FastAPI
|
import asyncio
|
||||||
|
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ async def hardware_status_monitor(websocket: WebSocket):
|
|||||||
|
|
||||||
result = await asyncio.wait_for(
|
result = await asyncio.wait_for(
|
||||||
asyncio.to_thread(
|
asyncio.to_thread(
|
||||||
get_hardware_status
|
hardware_status
|
||||||
),
|
),
|
||||||
timeout=3
|
timeout=3
|
||||||
)
|
)
|
||||||
@@ -92,4 +92,4 @@ if __name__ == "__main__":
|
|||||||
app,
|
app,
|
||||||
host="0.0.0.0",
|
host="0.0.0.0",
|
||||||
port=9100
|
port=9100
|
||||||
)
|
)
|
||||||
Reference in new issue
Block a user