diff --git a/code/planet/__init__.py b/code/planet/__init__.py index ddee136..94d3e88 100644 --- a/code/planet/__init__.py +++ b/code/planet/__init__.py @@ -578,7 +578,16 @@ def __init__(self, planet, url): self.exclude = None self.next_order = "0" self.cache_read() - self.cache_read_entries() + try: + self.cache_read_entries() + except SystemError: + # This can be triggered by https://github.com/python/cpython/issues/91228 (I think!) on + # some DBs, but really, only on macOS. While that is not how this is run in production, + # it's kinda nice to test. So, we catch the failure here, and flush the etag / modified + # fields so that update always works. + log.error(f"DB corruption for {url}; reloading the feed") + self.url_etag = None + self.url_modified = None if planet.config.has_section(url): for option in planet.config.options(url): @@ -618,6 +627,7 @@ def __iter__(self): def cache_read_entries(self): """Read entry information from the cache.""" + keys = self._cache.keys() for key in keys: if key.find(" ") != -1: