Compare commits

...

2 Commits

Author SHA1 Message Date
b58167f0de [P] Fix wrong row sending order
All checks were successful
Component testing / Hub testing (push) Successful in 35s
Component testing / Store testing (push) Successful in 26s
Component testing / Integration smoke testing (push) Successful in 2m37s
2026-03-25 23:26:39 +02:00
121bd007b3 [P] Add container logs printout on crash
Some checks failed
Component testing / Hub testing (push) Successful in 24s
Component testing / Store testing (push) Successful in 27s
Component testing / Integration smoke testing (push) Has been cancelled
2026-03-25 22:56:12 +02:00
2 changed files with 6 additions and 2 deletions

View File

@@ -45,7 +45,7 @@ async def websocket_endpoint(websocket: WebSocket, user_id: int):
try:
# send already available data
r = processed_agent_data.select()
r = processed_agent_data.select().order_by(processed_agent_data.c.timestamp)
stored_data = SessionLocal().execute(r).fetchall()
jsonable_data = [{c.name: getattr(i, c.name) for c in processed_agent_data.columns} for i in stored_data]
@@ -96,7 +96,7 @@ async def create_processed_agent_data(data: List[ProcessedAgentData], user_id: i
created_records = [dict(row._mapping) for row in result.fetchall()]
session.commit()
for record in created_records:
for record in sorted(created_records, key = lambda x: x['timestamp']):
await send_data_to_subscribers(jsonable_encoder(record))
return created_records
except Exception as err:

View File

@@ -1,4 +1,5 @@
import sys
import os
print("Checking for dead containers...")
@@ -14,6 +15,9 @@ for i in statuses:
if not i[status_index:].startswith("Up "):
service_name = i[name_index:]
print(f"Crash detected in {service_name}")
print(f"docker logs for the container:\n")
os.system(f"docker logs {i.split(' ')[0]}")
print()
exit_code = 1
sys.exit(exit_code)