better solution for STATIC_ROUTE_EXPIRY_TIME check (#12824)
This commit is contained in:
parent
d69a175a33
commit
4870779bf8
@ -15,17 +15,15 @@ class StaticRouteTimer(object):
|
|||||||
MAX_TIMER = 1800
|
MAX_TIMER = 1800
|
||||||
|
|
||||||
def set_timer(self):
|
def set_timer(self):
|
||||||
""" Check for custom route expiry time in STATIC_ROUTE:EXPIRY_TIME """
|
""" 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
|
|
||||||
timer = self.db.get(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME", "time")
|
timer = self.db.get(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME", "time")
|
||||||
if timer is not None:
|
if timer is not None:
|
||||||
timer = int(timer)
|
if timer.isdigit():
|
||||||
if timer > 0 and timer <= self.MAX_TIMER:
|
timer = int(timer)
|
||||||
self.timer = timer
|
if timer > 0 and timer <= self.MAX_TIMER:
|
||||||
return
|
self.timer = timer
|
||||||
log_err("Custom static route expiry time of {}s is invalid!".format(timer))
|
return
|
||||||
|
log_err("Custom static route expiry time of {}s is invalid!".format(timer))
|
||||||
return
|
return
|
||||||
|
|
||||||
def alarm(self):
|
def alarm(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user