added dashboard hashrate info

This commit is contained in:
UpstreamData
2022-03-04 11:53:31 -07:00
parent 58cc64d17b
commit 3945a86004
2 changed files with 99 additions and 39 deletions

View File

@@ -44,15 +44,14 @@ async def dashboard_websocket(websocket: WebSocket):
data_point = await all_data
all_miner_data.append(data_point)
all_miner_data.sort(key=lambda x: x["ip"])
try:
await websocket.send_json({"datetime": datetime.datetime.now().isoformat(),
"miners": all_miner_data})
except websockets.exceptions.ConnectionClosedOK:
print("disconnected")
await websocket.send_json({"datetime": datetime.datetime.now().isoformat(),
"miners": all_miner_data})
await asyncio.sleep(5)
except WebSocketDisconnect:
print("Websocket disconnected.")
pass
except websockets.exceptions.ConnectionClosedOK:
pass
async def get_miner_data_dashboard(miner_ip):
@@ -167,9 +166,11 @@ async def miner_websocket(websocket: WebSocket, miner_ip):
await asyncio.sleep(.5)
except WebSocketDisconnect:
print("Websocket disconnected.")
except websockets.exceptions.ConnectionClosedOK:
pass
@app.get("/miner/{miner_ip}")
def get_miner(request: Request, miner_ip):
return templates.TemplateResponse("miner.html", {
@@ -219,6 +220,7 @@ async def websocket_scan(websocket: WebSocket):
cur_task = None
except WebSocketDisconnect:
print("Websocket disconnected.")
except websockets.exceptions.ConnectionClosedOK:
pass