Only call should_heartbeat if auto_heartbeat is enabled
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
f1750d6df3
commit
c936703941
1 changed files with 10 additions and 8 deletions
|
@ -720,14 +720,16 @@ class XEP_0384(BasePlugin):
|
||||||
finally:
|
finally:
|
||||||
asyncio.ensure_future(self._publish_bundle())
|
asyncio.ensure_future(self._publish_bundle())
|
||||||
|
|
||||||
should_heartbeat = await self._should_heartbeat(sender, isPrekeyMessage)
|
if self.auto_heartbeat:
|
||||||
if self.auto_heartbeat and should_heartbeat:
|
log.debug('Checking if heartbeat is required. auto_hearbeat enabled.')
|
||||||
log.debug('Decryption: Sending hearbeat to JID: %r', jid)
|
should_heartbeat = await self._should_heartbeat(sender, isPrekeyMessage)
|
||||||
async def send_heartbeat():
|
if should_heartbeat:
|
||||||
log.debug('Sending a heartbeat message')
|
log.debug('Decryption: Sending hearbeat to JID %r', jid, device)
|
||||||
msg = await self.make_heartbeat(JID(jid))
|
async def send_heartbeat():
|
||||||
msg.send()
|
log.debug('Sending a heartbeat message')
|
||||||
asyncio.ensure_future(send_heartbeat())
|
msg = await self.make_heartbeat(JID(jid))
|
||||||
|
msg.send()
|
||||||
|
asyncio.ensure_future(send_heartbeat())
|
||||||
|
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue