Ensure storage I/O for ignored devices runs in the executor (#7792)
Some checks are pending
CI / Create common environment (push) Waiting to run
CI / Check black (push) Blocked by required conditions
CI / Check flake8 (push) Blocked by required conditions
CI / Check pylint (push) Blocked by required conditions
CI / Check pyupgrade (push) Blocked by required conditions
CI / Run script/ci-custom (push) Blocked by required conditions
CI / Run pytest (push) Blocked by required conditions
CI / Check clang-format (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 IDF (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP8266 (push) Blocked by required conditions
CI / list-components (push) Blocked by required conditions
CI / Component test (push) Blocked by required conditions
CI / Split components for testing into 20 groups maximum (push) Blocked by required conditions
CI / Test split components (push) Blocked by required conditions
CI / CI Status (push) Blocked by required conditions

This commit is contained in:
J. Nick Koston 2024-11-21 14:41:31 -06:00 committed by GitHub
parent 3232866dc3
commit 122ff731ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View file

@ -103,7 +103,7 @@ class ESPHomeDashboard:
self.loop = asyncio.get_running_loop()
self.ping_request = asyncio.Event()
self.entries = DashboardEntries(self)
self.load_ignored_devices()
await self.loop.run_in_executor(None, self.load_ignored_devices)
def load_ignored_devices(self) -> None:
storage_path = Path(ignored_devices_storage_path())

View file

@ -544,7 +544,7 @@ class ImportRequestHandler(BaseHandler):
class IgnoreDeviceRequestHandler(BaseHandler):
@authenticated
def post(self) -> None:
async def post(self) -> None:
dashboard = DASHBOARD
try:
args = json.loads(self.request.body.decode())
@ -576,7 +576,8 @@ class IgnoreDeviceRequestHandler(BaseHandler):
else:
dashboard.ignored_devices.discard(ignored_device.device_name)
dashboard.save_ignored_devices()
loop = asyncio.get_running_loop()
await loop.run_in_executor(None, dashboard.save_ignored_devices)
self.set_status(204)
self.finish()