1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-12 16:08:19 +00:00

dashboard: Run get_serial_ports in the executor

get_serial_ports does blocking I/O and should not be running
in tornado event loop
This commit is contained in:
J. Nick Koston 2023-11-12 18:17:17 -06:00
parent 53f3385c49
commit cad53556a5
No known key found for this signature in database

View File

@ -509,8 +509,8 @@ class EsphomeUpdateAllHandler(EsphomeCommandWebSocket):
class SerialPortRequestHandler(BaseHandler): class SerialPortRequestHandler(BaseHandler):
@authenticated @authenticated
def get(self): async def get(self):
ports = get_serial_ports() ports = await tornado.ioloop.IOLoop.run_in_executor(None, get_serial_ports)
data = [] data = []
for port in ports: for port in ports:
desc = port.description desc = port.description