mirror of
https://github.com/craigerl/aprsd.git
synced 2025-07-28 11:32:24 -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:
parent
98a96cbe34
commit
be6357a552
@ -100,7 +100,11 @@ class KeepAliveThread(APRSDThread):
|
|||||||
# check the APRS connection
|
# check the APRS connection
|
||||||
cl = client_factory.create()
|
cl = client_factory.create()
|
||||||
cl_stats = cl.stats()
|
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>")
|
LOGU.opt(colors=True).info(f"<green>Client keepalive {keepalive}</green>")
|
||||||
# Reset the connection if it's dead and this isn't our
|
# Reset the connection if it's dead and this isn't our
|
||||||
# First time through the loop.
|
# First time through the loop.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user