Skip to content

Commit

Permalink
[vrf]: Fix freezing during interface binding (#1325)
Browse files Browse the repository at this point in the history
* Replacing using 'get_all' with 'exists' in port state checking procedure inside bind function to avoid freezing in the while loop, what caused by absence of related record in STATE_DB.

Signed-off-by: Maksym Belei <[email protected]>
  • Loading branch information
maksymbelei95 authored and yxieca committed Feb 23, 2021
1 parent cc0bb6e commit aaa323a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3082,7 +3082,7 @@ def bind(ctx, interface_name, vrf_name):
state_db = SonicV2Connector(use_unix_socket_path=True, namespace=ctx.obj['namespace'])
state_db.connect(state_db.STATE_DB, False)
_hash = '{}{}'.format('INTERFACE_TABLE|', interface_name)
while state_db.get_all(state_db.STATE_DB, _hash) != None:
while state_db.exists(state_db.STATE_DB, _hash):
time.sleep(0.01)
state_db.close(state_db.STATE_DB)
config_db.set_entry(table_name, interface_name, {"vrf_name": vrf_name})
Expand Down

0 comments on commit aaa323a

Please sign in to comment.