Merge lp:~martin-hilton/juju-deployer/speed-up-inheritance into lp:juju-deployer

Proposed by Martin Hilton
Status: Rejected
Rejected by: Haw Loeung
Proposed branch: lp:~martin-hilton/juju-deployer/speed-up-inheritance
Merge into: lp:juju-deployer
Diff against target: 13 lines (+2/-1)
1 file modified
deployer/config.py (+2/-1)
To merge this branch: bzr merge lp:~martin-hilton/juju-deployer/speed-up-inheritance
Reviewer Review Type Date Requested Status
Tom Haddon Abstain
Francesco Banconi (community) Approve
juju-deployers Pending
Review via email: mp+320160@code.launchpad.net

Commit message

Stop extending the parents list whilst iterating over it when resolving inheritance.

Description of the change

Speed up inheritance by not extending the parents list at the same time as iterating over it.

To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote :

Looks good to me.

review: Approve
Revision history for this message
Roger Peppe (rogpeppe) wrote :

LGTM except that it really should have a test (ideally one that goes
into an infinite loop before this fix).

Also, given that it's almost certainly an infinite loop (correctness)
problem, the change description seems inaccurate.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Tom Haddon (mthaddon) wrote :

Abstaining since this is so old

review: Abstain

Unmerged revisions

211. By Martin Hilton

Stop extending the parents list whilst iterating over it when resolving inheritance.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'deployer/config.py'
--- deployer/config.py 2016-07-12 02:29:52 +0000
+++ deployer/config.py 2017-03-17 10:02:42 +0000
@@ -109,7 +109,8 @@
109 def _resolve_inherited(self, deploy_data):109 def _resolve_inherited(self, deploy_data):
110 if 'inherits' not in deploy_data:110 if 'inherits' not in deploy_data:
111 return deploy_data111 return deploy_data
112 inherits = parents = self._inherits(deploy_data)112 parents = self._inherits(deploy_data)
113 inherits = list(parents)
113 for parent_name in parents:114 for parent_name in parents:
114 parent = self.get(parent_name)115 parent = self.get(parent_name)
115 inherits.extend(self._inherits(parent.data))116 inherits.extend(self._inherits(parent.data))

Subscribers

People subscribed via source and target branches