delay stop_pending until the end of stop

avoids stop_pending being False while there's still one yield to go
This commit is contained in:
Min RK
2017-07-14 15:53:38 +02:00
parent c78d88707c
commit a6c2939bb4

View File

@@ -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