diff --git a/one/api.py b/one/api.py index 888b06e0..a00ef38a 100644 --- a/one/api.py +++ b/one/api.py @@ -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':