Error if we hit pending spawn limit

The backlog actually doesn't help - almost all of them fail,
and the exponential backoff just adds more work for our ticks
This commit is contained in:
yuvipanda
2017-07-27 20:36:59 -07:00
parent 27de44b0ec
commit d6827a2794

View File

@@ -369,15 +369,13 @@ class BaseHandler(RequestHandler):
if self.settings['concurrent_spawn_limit'] is not None and \
self.hub.pending_spawns > self.settings['concurrent_spawn_limit']:
# This will throw an error if we hit our timeout
self.log.info(
'More than %s pending spawns, throttling',
self.settings['concurrent_spawn_limit']
)
yield exponential_backoff(
lambda: self.hub.pending_spawns < self.settings['concurrent_spawn_limit'],
'Too many users are starting right now, try again later',
)
raise web.HTTPError(
429,
"Too many users are starting now, try again shortly")
self.hub.pending_spawns += 1
tic = IOLoop.current().time()