Fix typos
This commit is contained in:
parent
377eb480ca
commit
96dc600579
|
@ -283,44 +283,48 @@ class PresenceHandler(object):
|
||||||
"""Checks the presence of users that have timed out and updates as
|
"""Checks the presence of users that have timed out and updates as
|
||||||
appropriate.
|
appropriate.
|
||||||
"""
|
"""
|
||||||
|
logger.info("Handling presence timeouts")
|
||||||
now = self.clock.time_msec()
|
now = self.clock.time_msec()
|
||||||
|
|
||||||
with Measure(self.clock, "presence_handle_timeouts"):
|
try:
|
||||||
# Fetch the list of users that *may* have timed out. Things may have
|
with Measure(self.clock, "presence_handle_timeouts"):
|
||||||
# changed since the timeout was set, so we won't necessarily have to
|
# Fetch the list of users that *may* have timed out. Things may have
|
||||||
# take any action.
|
# changed since the timeout was set, so we won't necessarily have to
|
||||||
users_to_check = set(self.wheel_timer.fetch(now))
|
# take any action.
|
||||||
|
users_to_check = set(self.wheel_timer.fetch(now))
|
||||||
|
|
||||||
# Check whether the lists of syncing processes from an external
|
# Check whether the lists of syncing processes from an external
|
||||||
# process have expired.
|
# process have expired.
|
||||||
expired_process_ids = [
|
expired_process_ids = [
|
||||||
process_id for process_id, last_update
|
process_id for process_id, last_update
|
||||||
in self.external_process_last_update.items()
|
in self.external_process_last_updated_ms.items()
|
||||||
if now - last_update > EXTERNAL_PROCESS_EXPIRY
|
if now - last_update > EXTERNAL_PROCESS_EXPIRY
|
||||||
]
|
]
|
||||||
for process_id in expired_process_ids:
|
for process_id in expired_process_ids:
|
||||||
users_to_check.update(
|
users_to_check.update(
|
||||||
self.external_process_to_current_syncs.pop(process_id, ())
|
self.external_process_last_updated_ms.pop(process_id, ())
|
||||||
|
)
|
||||||
|
self.external_process_last_update.pop(process_id)
|
||||||
|
|
||||||
|
states = [
|
||||||
|
self.user_to_current_state.get(
|
||||||
|
user_id, UserPresenceState.default(user_id)
|
||||||
|
)
|
||||||
|
for user_id in users_to_check
|
||||||
|
]
|
||||||
|
|
||||||
|
timers_fired_counter.inc_by(len(states))
|
||||||
|
|
||||||
|
changes = handle_timeouts(
|
||||||
|
states,
|
||||||
|
is_mine_fn=self.is_mine_id,
|
||||||
|
syncing_user_ids=self.get_currently_syncing_users(),
|
||||||
|
now=now,
|
||||||
)
|
)
|
||||||
self.external_process_last_update.pop(process_id)
|
|
||||||
|
|
||||||
states = [
|
preserve_fn(self._update_states)(changes)
|
||||||
self.user_to_current_state.get(
|
except:
|
||||||
user_id, UserPresenceState.default(user_id)
|
logger.exception("Exception in _handle_timeouts loop")
|
||||||
)
|
|
||||||
for user_id in users_to_check
|
|
||||||
]
|
|
||||||
|
|
||||||
timers_fired_counter.inc_by(len(states))
|
|
||||||
|
|
||||||
changes = handle_timeouts(
|
|
||||||
states,
|
|
||||||
is_mine_fn=self.is_mine_id,
|
|
||||||
syncing_users=self.get_syncing_users(),
|
|
||||||
now=now,
|
|
||||||
)
|
|
||||||
|
|
||||||
preserve_fn(self._update_states)(changes)
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def bump_presence_active_time(self, user):
|
def bump_presence_active_time(self, user):
|
||||||
|
|
Loading…
Reference in New Issue