mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Only fetch the local ip once per run (#49336)
Wrap get_local_ip in lru_cache
This commit is contained in:
parent
252bcabbea
commit
b2c33c1373
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
from datetime import datetime, timedelta
|
||||
import enum
|
||||
from functools import wraps
|
||||
from functools import lru_cache, wraps
|
||||
import random
|
||||
import re
|
||||
import socket
|
||||
@ -129,6 +129,7 @@ def ensure_unique_string(
|
||||
|
||||
|
||||
# Taken from: http://stackoverflow.com/a/11735897
|
||||
@lru_cache(maxsize=None)
|
||||
def get_local_ip() -> str:
|
||||
"""Try to determine the local IP address of the machine."""
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user