Skip to content

Commit

Permalink
Merge pull request #167 from atlanticwave-sdx/fix/issue_166
Browse files Browse the repository at this point in the history
Change sleep call to be executed at the begin of pull topology routine
  • Loading branch information
italovalcy authored Nov 14, 2024
2 parents 6984650 + 39fda7c commit c5d2241
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions sdx_lc/jobs/pull_topo_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def main():

def process_domain_controller_topo(db_instance):
while True:
time.sleep(int(OXP_PULL_INTERVAL))
latest_topology_exists = False
latest_topology = db_instance.read_from_db("latest_topology")

Expand All @@ -52,11 +53,9 @@ def process_domain_controller_topo(db_instance):
pulled_topology = urllib.request.urlopen(OXP_PULL_URL).read()
except (urllib.request.URLError, ConnectionResetError):
logger.debug("Error connecting to domain controller...")
time.sleep(int(OXP_PULL_INTERVAL))
continue

if not pulled_topology:
time.sleep(int(OXP_PULL_INTERVAL))
continue

logger.debug("Pulled request from domain controller")
Expand Down Expand Up @@ -90,8 +89,6 @@ def process_domain_controller_topo(db_instance):
# Signal to end keep alive pings.
rpc_producer.stop()

time.sleep(int(OXP_PULL_INTERVAL))


if __name__ == "__main__":
main()

0 comments on commit c5d2241

Please sign in to comment.