mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-29 21:46:09 -05:00
Merge pull request #1179 from matrix-org/erikj/typing_timer_paranoia
Fix infinite typing bug
This commit is contained in:
commit
25423f50aa
@ -88,7 +88,7 @@ class TypingHandler(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
until = self._member_typing_until.get(member, None)
|
until = self._member_typing_until.get(member, None)
|
||||||
if not until or until < now:
|
if not until or until <= now:
|
||||||
logger.info("Timing out typing for: %s", member.user_id)
|
logger.info("Timing out typing for: %s", member.user_id)
|
||||||
preserve_fn(self._stopped_typing)(member)
|
preserve_fn(self._stopped_typing)(member)
|
||||||
continue
|
continue
|
||||||
@ -97,12 +97,20 @@ class TypingHandler(object):
|
|||||||
# user.
|
# user.
|
||||||
if self.hs.is_mine_id(member.user_id):
|
if self.hs.is_mine_id(member.user_id):
|
||||||
last_fed_poke = self._member_last_federation_poke.get(member, None)
|
last_fed_poke = self._member_last_federation_poke.get(member, None)
|
||||||
if not last_fed_poke or last_fed_poke + FEDERATION_PING_INTERVAL < now:
|
if not last_fed_poke or last_fed_poke + FEDERATION_PING_INTERVAL <= now:
|
||||||
preserve_fn(self._push_remote)(
|
preserve_fn(self._push_remote)(
|
||||||
member=member,
|
member=member,
|
||||||
typing=True
|
typing=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add a paranoia timer to ensure that we always have a timer for
|
||||||
|
# each person typing.
|
||||||
|
self.wheel_timer.insert(
|
||||||
|
now=now,
|
||||||
|
obj=member,
|
||||||
|
then=now + 60 * 1000,
|
||||||
|
)
|
||||||
|
|
||||||
def is_typing(self, member):
|
def is_typing(self, member):
|
||||||
return member.user_id in self._room_typing.get(member.room_id, [])
|
return member.user_id in self._room_typing.get(member.room_id, [])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user