diff sat/plugins/plugin_xep_0060.py @ 2769:9282b289b964

plugin XEP-0060: set a 30s timeout on items get
author Goffi <goffi@goffi.org>
date Fri, 11 Jan 2019 19:49:01 +0100
parents 3480d4fdf83a
children 003b8b4b56a7
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0060.py	Fri Jan 11 19:48:20 2019 +0100
+++ b/sat/plugins/plugin_xep_0060.py	Fri Jan 11 19:49:01 2019 +0100
@@ -26,7 +26,7 @@
 from sat.tools import sat_defer
 
 from twisted.words.protocols.jabber import jid, error
-from twisted.internet import defer
+from twisted.internet import reactor, defer
 from wokkel import disco
 from wokkel import data_form
 from zope.interface import implements
@@ -58,7 +58,7 @@
 Extra = namedtuple("Extra", ("rsm_request", "extra"))
 # rsm_request is the rsm.RSMRequest build with rsm_ prefixed keys, or None
 # extra is a potentially empty dict
-
+TIMEOUT = 30
 
 class XEP_0060(object):
     OPT_ACCESS_MODEL = "pubsub#access_model"
@@ -556,6 +556,7 @@
             )
             # we have no MAM data here, so we add None
             d.addCallback(lambda data: data + (None,))
+            d.addTimeout(TIMEOUT, reactor)
         else:
             # if mam is requested, we have to do a totally different query
             if self._mam is None: