summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-11-02 20:44:17 -0400
committerNagaraju Goruganti <ngorugan@in.ibm.com>2017-11-27 02:34:26 -0600
commit8e1f4ab73faf3afd7dffb06a481c74004d43e588 (patch)
tree5b7e9e803575447234c1979a888005747418fdc7
parentb15b6315f09335f6953d103dd382e693a0579455 (diff)
downloadphosphor-objmgr-8e1f4ab73faf3afd7dffb06a481c74004d43e588.tar.gz
phosphor-objmgr-8e1f4ab73faf3afd7dffb06a481c74004d43e588.zip
server: Performance improvements
When processing associations reduce the number of object manager list searches from four to one. Change-Id: I39603ca3cf22fd3090ef90be89690cad78d9ac4b Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
-rw-r--r--obmc/mapper/server.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/obmc/mapper/server.py b/obmc/mapper/server.py
index 72e1c53..08700c1 100644
--- a/obmc/mapper/server.py
+++ b/obmc/mapper/server.py
@@ -675,22 +675,23 @@ class ObjectMapper(dbus.service.Object):
def update_association(self, path, removed, added):
iface = obmc.dbuslib.enums.OBMC_ASSOC_IFACE
- create = [] if self.manager.get(path, False) else [iface]
+ assoc = self.manager.get(path, None)
+ create = [] if assoc else [iface]
if added and create:
self.manager.add(
path, Association(self.bus, path, added))
+ assoc = self.manager.get(path)
elif added:
- self.manager.get(path).append(added)
+ assoc.append(added)
- obj = self.manager.get(path, None)
- if obj and removed:
- obj.remove(removed)
+ if assoc and removed:
+ assoc.remove(removed)
- if obj and not obj.endpoints:
+ delete = []
+ if assoc and not assoc.endpoints:
self.manager.remove(path)
-
- delete = [] if self.manager.get(path, False) else [iface]
+ delete = [iface]
if create != delete:
self.update_interfaces(
OpenPOWER on IntegriCloud