should_heartbeat: correctly return what last commit said

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-07-17 03:39:48 +02:00
parent c7a0a092d4
commit baf29cb05f
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -557,7 +557,7 @@ class XEP_0384(BasePlugin):
receiving_chain_lengths = self._chain_lengths(jid).get('receiving', []) receiving_chain_lengths = self._chain_lengths(jid).get('receiving', [])
lengths = map(lambda d_l: d_l[1], receiving_chain_lengths) lengths = map(lambda d_l: d_l[1], receiving_chain_lengths)
min_length = reduce(lambda x, d_l: min(x, d_l[1]), receiving_chain_lengths, 0) == -1 min_length = reduce(lambda x, d_l: min(x, d_l[1]), receiving_chain_lengths, 0) == -1
return min_length or max(lengths, default=0) > self.heartbeat_after return min_length == -1 or max(lengths, default=0) > self.heartbeat_after
async def make_heartbeat(self, jid: JID) -> Message: async def make_heartbeat(self, jid: JID) -> Message:
""" """