def gc_event_queues(): # type: () -> None start = time.time() to_remove = set() # type: Set[str] affected_users = set() # type: Set[int] affected_realms = set() # type: Set[int] for (id, client) in clients.items(): if client.idle(start): to_remove.add(id) affected_users.add(client.user_profile_id) affected_realms.add(client.realm_id) # We don't need to call e.g. finish_current_handler on the clients # being removed because they are guaranteed to be idle and thus # not have a current handler. do_gc_event_queues(to_remove, affected_users, affected_realms) if settings.PRODUCTION: logging.info( ('Tornado removed %d idle event queues owned by %d users in %.3fs.' + ' Now %d active queues, %s') % (len(to_remove), len(affected_users), time.time() - start, len(clients), handler_stats_string())) statsd.gauge('tornado.active_queues', len(clients)) statsd.gauge('tornado.active_users', len(user_clients))
def gc_event_queues(port: int) -> None: start = time.time() to_remove: Set[str] = set() affected_users: Set[int] = set() affected_realms: Set[int] = set() for (id, client) in clients.items(): if client.expired(start): to_remove.add(id) affected_users.add(client.user_profile_id) affected_realms.add(client.realm_id) # We don't need to call e.g. finish_current_handler on the clients # being removed because they are guaranteed to be idle (because # they are expired) and thus not have a current handler. do_gc_event_queues(to_remove, affected_users, affected_realms) if settings.PRODUCTION: logging.info( "Tornado %d removed %d expired event queues owned by %d users in %.3fs." " Now %d active queues, %s", port, len(to_remove), len(affected_users), time.time() - start, len(clients), handler_stats_string(), ) statsd.gauge("tornado.active_queues", len(clients)) statsd.gauge("tornado.active_users", len(user_clients))
def gc_event_queues(): # type: () -> None start = time.time() to_remove = set() # type: Set[str] affected_users = set() # type: Set[int] affected_realms = set() # type: Set[int] for (id, client) in six.iteritems(clients): if client.idle(start): to_remove.add(id) affected_users.add(client.user_profile_id) affected_realms.add(client.realm_id) # We don't need to call e.g. finish_current_handler on the clients # being removed because they are guaranteed to be idle and thus # not have a current handler. do_gc_event_queues(to_remove, affected_users, affected_realms) logging.info(('Tornado removed %d idle event queues owned by %d users in %.3fs.' + ' Now %d active queues, %s') % (len(to_remove), len(affected_users), time.time() - start, len(clients), handler_stats_string())) statsd.gauge('tornado.active_queues', len(clients)) statsd.gauge('tornado.active_users', len(user_clients))
def gc_event_queues(port: int) -> None: start = time.time() to_remove = set() # type: Set[str] affected_users = set() # type: Set[int] affected_realms = set() # type: Set[int] for (id, client) in clients.items(): if client.expired(start): to_remove.add(id) affected_users.add(client.user_profile_id) affected_realms.add(client.realm_id) # We don't need to call e.g. finish_current_handler on the clients # being removed because they are guaranteed to be idle (because # they are expired) and thus not have a current handler. do_gc_event_queues(to_remove, affected_users, affected_realms) if settings.PRODUCTION: logging.info(('Tornado %d removed %d expired event queues owned by %d users in %.3fs.' + ' Now %d active queues, %s') % (port, len(to_remove), len(affected_users), time.time() - start, len(clients), handler_stats_string())) statsd.gauge('tornado.active_queues', len(clients)) statsd.gauge('tornado.active_users', len(user_clients))