Add constant for PlatformNotReady wait time to use in tests (#37266)
parent
0a0b60566d
commit
52f3238e17
|
@ -25,6 +25,7 @@ SLOW_SETUP_WARNING = 10
|
|||
SLOW_SETUP_MAX_WAIT = 60
|
||||
PLATFORM_NOT_READY_RETRIES = 10
|
||||
DATA_ENTITY_PLATFORM = "entity_platform"
|
||||
PLATFORM_NOT_READY_BASE_WAIT_TIME = 30 # seconds
|
||||
|
||||
|
||||
class EntityPlatform:
|
||||
|
@ -189,7 +190,7 @@ class EntityPlatform:
|
|||
return True
|
||||
except PlatformNotReady:
|
||||
tries += 1
|
||||
wait_time = min(tries, 6) * 30
|
||||
wait_time = min(tries, 6) * PLATFORM_NOT_READY_BASE_WAIT_TIME
|
||||
logger.warning(
|
||||
"Platform %s not ready yet. Retrying in %d seconds.",
|
||||
self.platform_name,
|
||||
|
|
|
@ -18,6 +18,7 @@ from homeassistant.components.influxdb.const import (
|
|||
from homeassistant.components.influxdb.sensor import PLATFORM_SCHEMA
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
from homeassistant.helpers.entity_platform import PLATFORM_NOT_READY_BASE_WAIT_TIME
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
@ -27,7 +28,6 @@ from tests.common import async_fire_time_changed
|
|||
INFLUXDB_PATH = "homeassistant.components.influxdb"
|
||||
INFLUXDB_CLIENT_PATH = f"{INFLUXDB_PATH}.InfluxDBClient"
|
||||
INFLUXDB_SENSOR_PATH = f"{INFLUXDB_PATH}.sensor"
|
||||
PLATFORM_NOT_READY_BASE_WAIT_TIME = 30
|
||||
|
||||
BASE_V1_CONFIG = {}
|
||||
BASE_V2_CONFIG = {
|
||||
|
|
Loading…
Reference in New Issue