Skip to content

Commit 76e64a0

Browse files
committed
Check for file-exists in read_cache()
1 parent b757359 commit 76e64a0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

plugwise_usb/helpers/cache.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ async def initialize_cache(self, create_root_folder: bool = False) -> None:
6464
cache_dir = self._get_writable_os_dir()
6565
await makedirs(cache_dir, exist_ok=True)
6666
self._cache_path = cache_dir
67-
6867
self._cache_file = os_path_join(self._cache_path, self._file_name)
69-
self._cache_file_exists = await ospath.exists(self._cache_file)
7068
self._initialized = True
7169
_LOGGER.debug("Start using network cache file: %s", self._cache_file)
7270

@@ -166,6 +164,7 @@ async def read_cache(self) -> dict[str, str]:
166164
_LOGGER.debug("Cache file has no name, return empty cache data")
167165
return current_data
168166

167+
self._cache_file_exists = await ospath.exists(self._cache_file)
169168
if not self._cache_file_exists:
170169
_LOGGER.debug(
171170
"Cache file '%s' does not exist, return empty cache data",

0 commit comments

Comments
 (0)