1
0
mirror of https://github.com/craigerl/aprsd.git synced 2025-04-22 11:18:53 -04:00

Put safety checks around the timeago for keepalive

If the client isn't running yet, the keepalive date will be
None, so we need a check around it before running timeago on it.
This commit is contained in:
Hemna 2024-11-23 09:15:30 -05:00
parent 98a96cbe34
commit be6357a552

View File

@ -100,7 +100,11 @@ class KeepAliveThread(APRSDThread):
# check the APRS connection
cl = client_factory.create()
cl_stats = cl.stats()
keepalive = timeago.format(cl_stats.get("keepalive", None))
ka = cl_stats.get("keepalive", None)
if ka:
keepalive = timeago.format(ka)
else:
keepalive = "N/A"
LOGU.opt(colors=True).info(f"<green>Client keepalive {keepalive}</green>")
# Reset the connection if it's dead and this isn't our
# First time through the loop.