This commit is contained in:
Sheng
2018-04-02 21:50:05 +08:00
parent 715d50907a
commit 20ba6bad36
+6 -7
View File
@@ -229,8 +229,8 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
try:
worker = self.ssh_connect()
except Exception as exc:
logging.error(traceback.format_exc())
future.set_exception(exc)
raise exc
else:
future.set_result(worker)
@@ -243,16 +243,15 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
status = None
future = Future()
threading.Thread(
target=self.ssh_connect_wrapped, args=(future,)
).start()
try:
threading.Thread(
target=self.ssh_connect_wrapped, args=(future,)
).start()
yield future
worker = yield future
except Exception as exc:
logging.error(traceback.format_exc())
status = str(exc)
else:
worker = future.result()
worker.src_addr = self.get_client_addr()
worker_id = worker.id
workers[worker_id] = worker