Mercurial > libervia-backend
diff sat/plugins/plugin_xep_0249.py @ 4001:32d714a8ea51
plugin XEP-0045: dot not wait for MAM retrieval to be completed:
in `_join_MAM`, `room.fully_joined` is called before retrieving the MAM archive, as the
process can be very long, and is not necessary to have the room working (message can be
received after being in the room, and added out of order). This avoid blocking the `join`
workflow for an extended time.
Some renaming and coroutine integrations.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 10 Mar 2023 17:22:41 +0100 |
parents | be6d91572633 |
children | 524856bd7b19 |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0249.py Fri Mar 10 17:01:09 2023 +0100 +++ b/sat/plugins/plugin_xep_0249.py Fri Mar 10 17:22:41 2023 +0100 @@ -17,19 +17,20 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from sat.core.i18n import _, D_ +from twisted.internet import defer +from twisted.words.protocols.jabber import jid +from twisted.words.xish import domish +from wokkel import disco, iwokkel +from zope.interface import implementer + +from sat.core import exceptions from sat.core.constants import Const as C -from sat.core import exceptions +from sat.core.i18n import D_, _ from sat.core.log import getLogger +from sat.tools import xml_tools log = getLogger(__name__) -from sat.tools import xml_tools -from twisted.words.xish import domish -from twisted.words.protocols.jabber import jid -from zope.interface import implementer - -from wokkel import disco, iwokkel try: @@ -140,7 +141,9 @@ _("Invitation accepted for room %(room)s [%(profile)s]") % {"room": room_jid.userhost(), "profile": client.profile} ) - d = self.host.plugins["XEP-0045"].join(client, room_jid, client.jid.user, {}) + d = defer.ensureDeferred( + self.host.plugins["XEP-0045"].join(client, room_jid, client.jid.user, {}) + ) return d def _messageReceivedTrigger(self, client, message_elt, post_treat):