Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-16 05:03:55 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-05-16 05:03:55 (GMT)
commit5d9e19a8921dc187a88a43d4e5407a289b32bc06 (patch)
treeae06b0bcff630017a0cb7a7272d0979f32f5dbc0 /services
parente659d15384908dbfa99d5c78f443bb857cc74cfe (diff)
Retry getting buddy properties a few times
Diffstat (limited to 'services')
-rw-r--r--services/presence/server_plugin.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/services/presence/server_plugin.py b/services/presence/server_plugin.py
index d4b7375..cd03c01 100644
--- a/services/presence/server_plugin.py
+++ b/services/presence/server_plugin.py
@@ -689,11 +689,22 @@ class ServerPlugin(gobject.GObject):
self._conn[CONN_INTERFACE_ALIASING].RequestAliases([handle],
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))
-
- def _contact_online_properties_error_cb(self, handle, err):
- """Handle error retrieving property-set for a user (handle)"""
- logging.debug("Handle %s - Error getting properties: %s" % (handle, err))
- self._contact_offline(handle)
+
+ 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)"""
+ 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))
+ self._contact_offline(handle)
def _contact_online(self, handle):
"""Handle a contact coming online"""
@@ -705,9 +716,7 @@ class ServerPlugin(gobject.GObject):
# are handled locally
return
- 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, *args))
+ self._contact_online_request_properties(handle, 1)
def _presence_update_cb(self, presence):
"""Send update for online/offline status of presence"""