Skip to content

Commit 18a5ccc

Browse files
committed
fix: load cache error when CacheDecoder object is not callable
1 parent 4bf72d7 commit 18a5ccc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

dynamic/discovery.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
import os
1616
import six
1717
import json
18+
import logging
1819
import hashlib
1920
import tempfile
21+
from functools import partial
2022
from collections import defaultdict
2123
from abc import abstractmethod, abstractproperty
2224

@@ -54,11 +56,12 @@ def __init_cache(self, refresh=False):
5456
else:
5557
try:
5658
with open(self.__cache_file, 'r') as f:
57-
self._cache = json.load(f, cls=CacheDecoder(self.client))
59+
self._cache = json.load(f, cls=partial(CacheDecoder, self.client))
5860
if self._cache.get('library_version') != __version__:
5961
# Version mismatch, need to refresh cache
6062
self.invalidate_cache()
61-
except Exception:
63+
except Exception as e:
64+
logging.error("load cache error: %s", e)
6265
self.invalidate_cache()
6366
self._load_server_info()
6467
self.discover()

0 commit comments

Comments
 (0)