better solution for STATIC_ROUTE_EXPIRY_TIME check (#12824)

This commit is contained in:
jcaiMR 2022-11-25 20:12:41 +08:00 committed by GitHub
parent d69a175a33
commit 4870779bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,12 +15,10 @@ class StaticRouteTimer(object):
MAX_TIMER = 1800
def set_timer(self):
""" Check for custom route expiry time in STATIC_ROUTE:EXPIRY_TIME """
keys = self.db.keys(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME")
if len(keys) == 0:
return
""" Check for custom route expiry time in STATIC_ROUTE_EXPIRY_TIME """
timer = self.db.get(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME", "time")
if timer is not None:
if timer.isdigit():
timer = int(timer)
if timer > 0 and timer <= self.MAX_TIMER:
self.timer = timer