diff --git a/core/sig_lookup_helper.py b/core/sig_lookup_helper.py index aebfcd0..a16d785 100644 --- a/core/sig_lookup_helper.py +++ b/core/sig_lookup_helper.py @@ -114,16 +114,23 @@ def get_sig_ref_info(sig_name, ref_id): # OK, this is something we have to look up. Now check to see if our data store contains reference data and if # so, copy the data into the sig_ref object key = f"{sig_name}:{ref_id}" - lookup_data = DATA_STORE.sigrefs.get(key) if key in DATA_STORE.sigrefs else None - if lookup_data: - for key, value in lookup_data.__dict__.items(): - if value is not None and sig_ref.__dict__.get(key) is None: - sig_ref.__dict__[key] = value + try: + lookup_data = DATA_STORE.sigrefs.get(key) if key in DATA_STORE.sigrefs else None + if lookup_data: + for key, value in lookup_data.__dict__.items(): + if value is not None and sig_ref.__dict__.get(key) is None: + sig_ref.__dict__[key] = value - else: - # Maybe a super new reference we don't know about yet, but more likely a typo or a test reference, - # just silently ignore it. - logger.debug(f"{sig_name} database did not contain data for ref {ref_id}") + else: + # Maybe a super new reference we don't know about yet, but more likely a typo or a test reference, + # just silently ignore it. + logger.debug(f"{sig_name} database did not contain data for ref {ref_id}") + + 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 DATA_STORE.sigrefs[key] + return None except Exception: logger.exception(f"Exception when looking up sig_ref info for {sig_name} ref {ref_id}") diff --git a/providers/callsigndata/callsign_data_provider.py b/providers/callsigndata/callsign_data_provider.py index d4b0be3..97997a2 100644 --- a/providers/callsigndata/callsign_data_provider.py +++ b/providers/callsigndata/callsign_data_provider.py @@ -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: diff --git a/templates/add_spot.html b/templates/add_spot.html index 087702c..4b98ffb 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -77,7 +77,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index 760b795..b3d4f50 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -83,7 +83,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 8b77f3a..c54fc3f 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,8 +76,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 7cd3d3e..9340159 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -16,10 +16,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index 3cbd0fd..e4ad3e5 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index 8ac296e..c25f839 100644 --- a/templates/map.html +++ b/templates/map.html @@ -113,8 +113,8 @@ const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}"; - - + + diff --git a/templates/spots.html b/templates/spots.html index a57df67..f4ac510 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -125,8 +125,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index 4bb69c5..511444f 100644 --- a/templates/status.html +++ b/templates/status.html @@ -96,7 +96,7 @@ - +