comparison sat/memory/cache.py @ 3572:b3fa179417e7

core (memory/cache): don't crash on EOFError in getMetadata
author Goffi <goffi@goffi.org>
date Thu, 17 Jun 2021 10:35:42 +0200
parents be6d91572633
children 2863345c9bbb
comparison
equal deleted inserted replaced
3571:56a4a574861d 3572:b3fa179417e7
138 return None 138 return None
139 139
140 try: 140 try:
141 with cache_url.open("rb") as f: 141 with cache_url.open("rb") as f:
142 cache_data = pickle.load(f) 142 cache_data = pickle.load(f)
143 except IOError as e: 143 except (IOError, EOFError) as e:
144 log.warning(f"can't read cache at {cache_url}: {e}") 144 log.warning(f"can't read cache at {cache_url}: {e}")
145 return None 145 return None
146 except pickle.UnpicklingError: 146 except pickle.UnpicklingError:
147 log.warning(f"invalid cache found at {cache_url}") 147 log.warning(f"invalid cache found at {cache_url}")
148 return None 148 return None