@gen.coroutine
    def check_routes(self, user_dict, routes=None):
        if not routes:
            routes = yield self.get_routes()

        have_routes = { r['user'] for r in routes.values() if 'user' in r }
        futures = []
        db = inspect(self).session
        for orm_user in db.query(User).filter(User.server != None):
            user = user_dict[orm_user]
            if not user.running:
                # Don't add users to the proxy that haven't finished starting
                continue
            if user.server is None:
                # This should never be True, but seems to be on rare occasion.
                # catch filter bug, either in sqlalchemy or my understanding of its behavior
                self.log.error("User %s has no server, but wasn't filtered out.", user)
                continue
            if user.name not in have_routes:
                self.log.warning("Adding missing route for %s (%s)", user.name, user.server)
                futures.append(self.add_user(user))
        for f in futures:
            yield f
Check that all users are properly routed on the proxy
dataset/ETHPy150Open jupyterhub/jupyterhub/jupyterhub/orm.py/Proxy.check_routes