mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Improve protection against old unsupported objects (e.g. LocationSourceForCallsign.NONE) coming back from the cache and throwing exceptions
This commit is contained in:
@@ -42,7 +42,13 @@ class CallsignDataProvider:
|
||||
|
||||
if self.enabled:
|
||||
if callsign in self._storage:
|
||||
return self._storage[callsign]
|
||||
try:
|
||||
return self._storage[callsign]
|
||||
except (ValueError, KeyError):
|
||||
# Catch exceptions due to e.g. old versions of objects in the cache that are no longer compatible,
|
||||
# and remove them from the cache.
|
||||
del self._storage[callsign]
|
||||
return None
|
||||
else:
|
||||
c = self._perform_new_lookup(callsign, lookup_credentials)
|
||||
if c:
|
||||
|
||||
Reference in New Issue
Block a user