mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Rename DCC project into RAM
RAM: Railroad Assets Manager
This commit is contained in:
22
ram/driver/health.py
Normal file
22
ram/driver/health.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from health_check.backends import BaseHealthCheckBackend
|
||||
from health_check.exceptions import (
|
||||
ServiceUnavailable,
|
||||
ServiceReturnedUnexpectedResult,
|
||||
)
|
||||
|
||||
from driver.connector import Connector
|
||||
|
||||
|
||||
class DriverHealthCheck(BaseHealthCheckBackend):
|
||||
critical_service = False
|
||||
|
||||
def check_status(self):
|
||||
try:
|
||||
Connector().passthrough(b"<s>")
|
||||
except ConnectionRefusedError as e:
|
||||
self.add_error(ServiceUnavailable("IOError"), e)
|
||||
except Exception as e:
|
||||
self.add_error(ServiceReturnedUnexpectedResult("IOError"), e)
|
||||
|
||||
def identifier(self):
|
||||
return "DriverDaemon"
|
Reference in New Issue
Block a user