Added a bool timeout to logs. This indicated whether or not the request timed out. Preparing data for the frontend graph is put into it's own function. When data is more than 6 s apart it is considered a break in connectivity and a None point is added.

This commit is contained in:
2025-09-05 11:57:34 +02:00
parent e1b0ab4dc5
commit 139be129ee
5 changed files with 80 additions and 7 deletions

View File

@@ -13,13 +13,17 @@ class log(db.Model):
nullable=False,
)
ping: Optional[int] = db.Column(db.Integer, nullable=True)
timeout: bool = db.Column(db.Boolean, nullable=False)
def __init__(self, service_id: int, ping: Optional[int]):
def __init__(
self, service_id: int, ping: Optional[int], timeout: bool = False
):
super().__init__()
self.service_id = service_id
self.ping = ping
self.dateCreated = datetime.now(timezone.utc)
self.timeout = timeout
def to_dict(self) -> dict[str, Any]:
return {
@@ -27,6 +31,7 @@ class log(db.Model):
"service_id": self.service_id,
"ping": self.ping,
"dateCreated": self.dateCreated,
"timeout": self.timeout,
}