Skip to content

Commit

Permalink
Added conditional to avoid extra copy
Browse files Browse the repository at this point in the history
  • Loading branch information
viniarck committed Oct 25, 2021
1 parent 3952ce5 commit 3547d40
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,12 @@ def _store_changed_flows(self, command, flow, switch):
deleted_flows_idxs.add(i)
break

stored_flows = [
flow
for i, flow in enumerate(stored_flows)
if i not in deleted_flows_idxs
]
if deleted_flows_idxs:
stored_flows = [
flow
for i, flow in enumerate(stored_flows)
if i not in deleted_flows_idxs
]
if should_persist_flow:
stored_flows.append(installed_flow)
stored_flows_box[switch.id]['flow_list'] = stored_flows
Expand Down

0 comments on commit 3547d40

Please sign in to comment.