mirror of
				https://github.com/StefBuwalda/dashboard_test.git
				synced 2025-10-31 03:39:58 +00:00 
			
		
		
		
	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:
		| @@ -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, | ||||
|         } | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user