Skip to content

Commit

Permalink
Handle loaded_time == None in refresh_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
k1o0 committed Oct 11, 2024
1 parent 1b3dd53 commit f042aaa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion one/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ def refresh_cache(self, mode='auto'):
if mode in {'local', 'remote'}:
pass
elif mode == 'auto':
if datetime.now() - self._cache['_meta']['loaded_time'] >= self.cache_expiry:
loaded_time = self._cache['_meta']['loaded_time']
if not loaded_time or (datetime.now() - loaded_time >= self.cache_expiry):
_logger.info('Cache expired, refreshing')
self.load_cache()
elif mode == 'refresh':
Expand Down

0 comments on commit f042aaa

Please sign in to comment.