Skip to content

Commit

Permalink
ReadTimeout hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
romanov committed Sep 7, 2022
1 parent 7989e3c commit 80fcc49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions sla/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
ConnectHandler,
NetmikoTimeoutException,
NetmikoAuthenticationException,
BaseConnection
BaseConnection,
ReadTimeout
)
import textfsm
from sla.logger import LG
Expand Down Expand Up @@ -96,9 +97,15 @@ def __batch_remote_check(self, hnd: BaseConnection, targets: list, fsm: textfsm.
sleep(target.delay)
_ = None
command: str = self.__create_rtt_command(target.target)
result = hnd.send_command(command)
LG.debug(f"RTT command sent to {self.name} device")
try:
result = hnd.send_command(command)
except ReadTimeout:
LG.debug(f"ReadTimeout error on {self.name} device for {target.target} target")
continue # Ignore ReadTimeout error and continue checking
LG.debug(f"Command [{command}] sent to {self.name} device")
LG.debug(f"Recieved [{result}] from {self.name} device")
output = fsm.ParseText(result)
LG.debug(f"Parsed data [{output}] from {self.name} device")
try:
rtt = float(output[iter][0])
except IndexError as ex:
Expand Down
2 changes: 1 addition & 1 deletion sla/sla.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __collect(self):
while True:
with Lock():
REGISTRY.collect()
LG.debug(f"Registry collection finished with delay time {_} s")
LG.info(f"Registry collection finished with delay time {_} s")
sleep(_)

def _run(self):
Expand Down

0 comments on commit 80fcc49

Please sign in to comment.