Adding better logging for tasks
This commit is contained in:
@@ -93,7 +93,7 @@ async def handle_message(msg):
|
|||||||
|
|
||||||
elif event_type == "status":
|
elif event_type == "status":
|
||||||
# Handle explicit Offline messages (LWT or clean shutdown)
|
# Handle explicit Offline messages (LWT or clean shutdown)
|
||||||
print(f"Status update for {node_id}: {payload.get('status')}")
|
print(f"Status update for {node_id}: {payload.get('status')} (Reason: {payload.get('reason', 'unknown')})")
|
||||||
status = payload.get("status")
|
status = payload.get("status")
|
||||||
|
|
||||||
data = {"status": status, "last_seen": timestamp}
|
data = {"status": status, "last_seen": timestamp}
|
||||||
@@ -167,6 +167,7 @@ async def node_sweeper():
|
|||||||
print("Starting Node Sweeper...")
|
print("Starting Node Sweeper...")
|
||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(60)
|
await asyncio.sleep(60)
|
||||||
|
print("Sweeping nodes...")
|
||||||
try:
|
try:
|
||||||
nodes_ref = db.collection("nodes")
|
nodes_ref = db.collection("nodes")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user