Skip to content

Commit

Permalink
Avoid excessive memory usage in cache (#1649)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ authored Aug 20, 2024
1 parent 9d485c1 commit ecc116e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 2024.8.9 (2024-08-20)

- Avoid excessive memory usage in cache

# Version 2024.8.8 (2024-08-18)

- Refactor folder handling
Expand Down
8 changes: 3 additions & 5 deletions hahomematic/caches/persistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def __init__(self, central: hmcu.CentralUnit) -> None:
)

# {(device_address, parameter), [channel_no]}
self._address_parameter_cache: Final[dict[tuple[str, str], list[int]]] = {}
self._address_parameter_cache: Final[dict[tuple[str, str], set[int]]] = {}

@property
def raw_paramset_descriptions(self) -> dict[str, dict[str, dict[str, dict[str, Any]]]]:
Expand Down Expand Up @@ -399,10 +399,8 @@ def _init_address_parameter_list(self) -> None:
device_address,
parameter,
) not in self._address_parameter_cache:
self._address_parameter_cache[(device_address, parameter)] = []
self._address_parameter_cache[(device_address, parameter)].append(
channel_no
)
self._address_parameter_cache[(device_address, parameter)] = set()
self._address_parameter_cache[(device_address, parameter)].add(channel_no)

async def load(self) -> DataOperationResult:
"""Load paramset descriptions from disk into paramset cache."""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "hahomematic"
version = "2024.8.8"
version = "2024.8.9"
license = {text = "MIT License"}
description = "Homematic interface for Home Assistant running on Python 3."
readme = "README.md"
Expand Down

0 comments on commit ecc116e

Please sign in to comment.