periodically poll single-user servers

If they aren't running, unregister them
and remove them from the proxy so that future
logins are handled by the hub, and spawn new servers.
This commit is contained in:
MinRK
2014-09-22 16:04:17 -07:00
parent 1f3fe9c84d
commit 7af715864c
3 changed files with 88 additions and 7 deletions

View File

@@ -169,8 +169,18 @@ class BaseHandler(RequestHandler):
config=self.config,
)
yield self.proxy.add_user(user)
user.spawner.add_poll_callback(self.user_stopped, user)
raise gen.Return(user)
@gen.coroutine
def user_stopped(self, user):
status = yield user.spawner.poll()
self.log.warn("User %s server stopped, with exit code: %s",
user.name, status,
)
yield self.proxy.delete_user(user)
yield user.stop()
@gen.coroutine
def stop_single_user(self, user):
yield self.proxy.delete_user(user)