Retry getting buddy properties a few times

This commit is contained in:
Dan Williams 2007-05-16 01:03:55 -04:00
parent e659d15384
commit 5d9e19a892

View File

@ -690,8 +690,19 @@ class ServerPlugin(gobject.GObject):
reply_handler=lambda *args: self._contact_online_aliases_cb(handle, props, *args), reply_handler=lambda *args: self._contact_online_aliases_cb(handle, props, *args),
error_handler=lambda *args: self._contact_online_aliases_error_cb(handle, props, True, *args)) error_handler=lambda *args: self._contact_online_aliases_error_cb(handle, props, True, *args))
def _contact_online_properties_error_cb(self, handle, err): def _contact_online_request_properties(self, handle, tries):
self._conn[CONN_INTERFACE_BUDDY_INFO].GetProperties(handle,
reply_handler=lambda *args: self._contact_online_properties_cb(handle, *args),
error_handler=lambda *args: self._contact_online_properties_error_cb(handle, tries, *args))
return False
def _contact_online_properties_error_cb(self, handle, tries, err):
"""Handle error retrieving property-set for a user (handle)""" """Handle error retrieving property-set for a user (handle)"""
if tries <= 3:
logging.debug("Handle %s - Error getting properties (will retry): %s" % (handle, err))
tries += 1
gobject.timeout_add(1000, self._contact_online_request_properties, handle, tries)
else:
logging.debug("Handle %s - Error getting properties: %s" % (handle, err)) logging.debug("Handle %s - Error getting properties: %s" % (handle, err))
self._contact_offline(handle) self._contact_offline(handle)
@ -705,9 +716,7 @@ class ServerPlugin(gobject.GObject):
# are handled locally # are handled locally
return return
self._conn[CONN_INTERFACE_BUDDY_INFO].GetProperties(handle, self._contact_online_request_properties(handle, 1)
reply_handler=lambda *args: self._contact_online_properties_cb(handle, *args),
error_handler=lambda *args: self._contact_online_properties_error_cb(handle, *args))
def _presence_update_cb(self, presence): def _presence_update_cb(self, presence):
"""Send update for online/offline status of presence""" """Send update for online/offline status of presence"""