From a6c2939bb4932bfd7dcaf52acf0319eb3dc2db0f Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 14 Jul 2017 15:53:38 +0200 Subject: [PATCH] delay stop_pending until the end of stop avoids stop_pending being False while there's still one yield to go --- jupyterhub/user.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jupyterhub/user.py b/jupyterhub/user.py index 223e674f..34a06431 100644 --- a/jupyterhub/user.py +++ b/jupyterhub/user.py @@ -393,10 +393,13 @@ class User(HasTraits): self.db.delete(orm_token) self.db.commit() finally: - self.stop_pending = False # trigger post-spawner hook on authenticator auth = spawner.authenticator - if auth: - yield gen.maybe_future( - auth.post_spawn_stop(self, spawner) - ) + try: + if auth: + yield gen.maybe_future( + auth.post_spawn_stop(self, spawner) + ) + except Exception: + self.log.exception("Error in Authenticator.post_spawn_stop for %s", self) + self.stop_pending = False