def proxy(self, port, path):
if not path.startswith('/'):
path = '/' + path
# if we're in 'starting' let's wait a while
for i in range(5):
if not self.state.get('starting', False):
break
# Simple exponential backoff
wait_time = max(1.4 ** i, 5)
self.log.debug('Waiting {} before checking if rstudio is up'.format(wait_time))
yield gen.sleep(wait_time)
else:
raise web.HTTPError('could not start rsession in time', status_code=500)
# FIXME: try to not start multiple processes at a time with some locking here
if 'proc' not in self.state:
self.log.info('No existing process rsession process found')
yield self.start_process()
return (yield super().proxy(self.port, path))
评论列表
文章目录