Skip to content

Commit 00b37c9

Browse files
committed
check if cache is available before prune operation
1 parent 75aa598 commit 00b37c9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugwise_usb/network/registry.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ async def remove_network_registration(self, mac: str) -> None:
172172
"""Remove a mac to the network registration list."""
173173
if mac in self._registry:
174174
self._registry.remove(mac)
175-
await self._network_cache.prune_cache(self._registry)
175+
if self._network_cache is not None:
176+
await self._network_cache.prune_cache(self._registry)
176177

177178
async def update_missing_registrations_circleplus(self) -> None:
178179
"""Full retrieval of all (unknown) network registrations from network controller."""
@@ -197,7 +198,8 @@ async def update_missing_registrations_circleplus(self) -> None:
197198
await sleep(self._registration_scan_delay)
198199
_LOGGER.debug("CirclePlus registry scan finished")
199200
self._scan_completed = True
200-
await self._network_cache.prune_cache(_maintenance_registry)
201+
if self._network_cache is not None:
202+
await self._network_cache.prune_cache(_maintenance_registry)
201203

202204
async def load_registrations_from_cache(self) -> None:
203205
"""Quick retrieval of all unknown network registrations from cache."""

0 commit comments

Comments
 (0)