More follow_name_owner_changed optimiztion

* reasoning changed from a FIXME to a NOTE to explain why we need
     to follow_name_owner_changed
This commit is contained in:
John (J5) Palmieri 2007-08-24 18:25:56 -04:00
parent 628fe7b5da
commit 2cae66b0ea
3 changed files with 21 additions and 6 deletions

View File

@ -50,10 +50,11 @@ class ActivityRegistry(gobject.GObject):
bus = dbus.SessionBus() bus = dbus.SessionBus()
# FIXME: Is follow_name_owner_changes what we really want? # NOTE: We need to follow_name_owner_changes here
# It speeds up the start time by about 2 seconds # because we can not connect to a signal unless
# but is really a side effect of starting a proxy # we follow the changes or we start the service
# in this state (i.e. we don't block in the constructor) # before we connect. Starting the service here
# causes a major bottleneck during startup
bus_object = bus.get_object(_ACTIVITY_REGISTRY_SERVICE_NAME, bus_object = bus.get_object(_ACTIVITY_REGISTRY_SERVICE_NAME,
_ACTIVITY_REGISTRY_PATH, _ACTIVITY_REGISTRY_PATH,
follow_name_owner_changes = True) follow_name_owner_changes = True)

View File

@ -82,7 +82,14 @@ class ClipboardService(gobject.GObject):
"""Connect dbus signals to our GObject signal generating callbacks""" """Connect dbus signals to our GObject signal generating callbacks"""
bus = dbus.SessionBus() bus = dbus.SessionBus()
if not self._connected: if not self._connected:
proxy_obj = bus.get_object(DBUS_SERVICE, DBUS_PATH) # NOTE: We need to follow_name_owner_changes here
# because we can not connect to a signal unless
# we follow the changes or we start the service
# before we connect. Starting the service here
# causes a major bottleneck during startup
proxy_obj = bus.get_object(DBUS_SERVICE,
DBUS_PATH,
follow_name_owner_changes=True)
self._dbus_service = dbus.Interface(proxy_obj, DBUS_SERVICE) self._dbus_service = dbus.Interface(proxy_obj, DBUS_SERVICE)
self._dbus_service.connect_to_signal('object_added', self._dbus_service.connect_to_signal('object_added',
self._object_added_cb) self._object_added_cb)

View File

@ -108,8 +108,15 @@ class PresenceService(gobject.GObject):
""" """
if not self._ps_: if not self._ps_:
try: try:
# NOTE: We need to follow_name_owner_changes here
# because we can not connect to a signal unless
# we follow the changes or we start the service
# before we connect. Starting the service here
# causes a major bottleneck during startup
ps = dbus.Interface( ps = dbus.Interface(
self._bus.get_object(DBUS_SERVICE,DBUS_PATH), self._bus.get_object(DBUS_SERVICE,
DBUS_PATH,
follow_name_owner_changes=True),
DBUS_INTERFACE DBUS_INTERFACE
) )
except dbus.exceptions.DBusException, err: except dbus.exceptions.DBusException, err: