mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 01:07:10 +00:00
Switch recorder to use async_timeout instead of asyncio.wait_for (#78607)
This commit is contained in:
parent
51b01fcd80
commit
6e4a0b9fdc
@ -13,6 +13,7 @@ import threading
|
||||
import time
|
||||
from typing import Any, TypeVar, cast
|
||||
|
||||
import async_timeout
|
||||
from awesomeversion import AwesomeVersion
|
||||
from lru import LRU # pylint: disable=no-name-in-module
|
||||
from sqlalchemy import create_engine, event as sqlalchemy_event, exc, func, select
|
||||
@ -1030,7 +1031,8 @@ class Recorder(threading.Thread):
|
||||
task = DatabaseLockTask(database_locked, threading.Event(), False)
|
||||
self.queue_task(task)
|
||||
try:
|
||||
await asyncio.wait_for(database_locked.wait(), timeout=DB_LOCK_TIMEOUT)
|
||||
async with async_timeout.timeout(DB_LOCK_TIMEOUT):
|
||||
await database_locked.wait()
|
||||
except asyncio.TimeoutError as err:
|
||||
task.database_unlock.set()
|
||||
raise TimeoutError(
|
||||
|
Loading…
x
Reference in New Issue
Block a user