tweak sleep granularity

This commit is contained in:
Will McGugan
2023-01-26 16:18:23 +01:00
parent 683d44dc93
commit e231788433

View File

@@ -2,15 +2,17 @@ from asyncio import sleep
from time import process_time, time
SLEEP_GRANULARITY: float = 1 / 100
SLEEP_GRANULARITY: float = 1 / 50
SLEEP_IDLE: float = SLEEP_GRANULARITY / 2.0
async def wait_for_idle(min_sleep: float = 0.01, max_sleep: float = 1) -> None:
async def wait_for_idle(
min_sleep: float = SLEEP_GRANULARITY, max_sleep: float = 1
) -> None:
"""Wait until the cpu isn't working very hard.
Args:
min_sleep: Minimum time to wait. Defaults to 0.01.
min_sleep: Minimum time to wait. Defaults to 1/50.
max_sleep: Maximum time to wait. Defaults to 1.
"""
start_time = time()