add waiting_for_response indicator on User

.spawn_pending used for the *whole* window, from request to responsive (added to proxy)
.waiting_for_response is just used for the window between Spawner.start returning (process started, http endpoint known) and http endpoint becoming responsive

.waiting_for_response will never be True while .spawn_pending is False
This commit is contained in:
Min RK
2016-10-07 10:58:26 +02:00
parent 625e76ea40
commit 933478bfff
2 changed files with 14 additions and 5 deletions

View File

@@ -99,6 +99,7 @@ class User(HasTraits):
spawner = None
spawn_pending = False
stop_pending = False
waiting_for_response = False
@property
def authenticator(self):
@@ -258,6 +259,7 @@ class User(HasTraits):
self.state = spawner.get_state()
self.last_activity = datetime.utcnow()
db.commit()
self.waiting_for_response = True
try:
yield self.server.wait_up(http=True, timeout=spawner.http_timeout)
except Exception as e:
@@ -284,7 +286,9 @@ class User(HasTraits):
), exc_info=True)
# raise original TimeoutError
raise e
self.spawn_pending = False
finally:
self.waiting_for_response = False
self.spawn_pending = False
return self
@gen.coroutine