Skip to content

Commit 39fda7c

Browse files
author
Italo Valcy
committed
moving time.sleep to begin of pull topology routine to avoid unnecessary requests when topology is not ready (by all means)
1 parent 6984650 commit 39fda7c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

sdx_lc/jobs/pull_topo_changes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def main():
2929

3030
def process_domain_controller_topo(db_instance):
3131
while True:
32+
time.sleep(int(OXP_PULL_INTERVAL))
3233
latest_topology_exists = False
3334
latest_topology = db_instance.read_from_db("latest_topology")
3435

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

5858
if not pulled_topology:
59-
time.sleep(int(OXP_PULL_INTERVAL))
6059
continue
6160

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

93-
time.sleep(int(OXP_PULL_INTERVAL))
94-
9592

9693
if __name__ == "__main__":
9794
main()

0 commit comments

Comments
 (0)