diff --git a/solarconditionsproviders/solar_conditions_provider.py b/solarconditionsproviders/solar_conditions_provider.py index 364625b..7479456 100644 --- a/solarconditionsproviders/solar_conditions_provider.py +++ b/solarconditionsproviders/solar_conditions_provider.py @@ -16,10 +16,11 @@ class SolarConditionsProvider: self.status = "Not Started" if self.enabled else "Disabled" self._solar_conditions = None - def setup(self, solar_conditions): - """Set up the provider, giving it the solar conditions dict to update""" + def setup(self, solar_conditions, solar_conditions_cache): + """Set up the provider, giving it the solar conditions object and its backing cache""" self._solar_conditions = solar_conditions + self._solar_conditions_cache = solar_conditions_cache def start(self): """Start the provider. This should return immediately after spawning threads to access the remote resources""" @@ -39,3 +40,4 @@ class SolarConditionsProvider: if hasattr(self._solar_conditions, key): setattr(self._solar_conditions, key, value) self._solar_conditions.infer_descriptions() + self._solar_conditions_cache['solar_conditions'] = self._solar_conditions diff --git a/spothole.py b/spothole.py index 4e917ce..30b6b4e 100644 --- a/spothole.py +++ b/spothole.py @@ -18,7 +18,8 @@ from server.webserver import WebServer # Globals spots = Cache('cache/spots_cache') alerts = Cache('cache/alerts_cache') -solar_conditions = SolarConditions() +solar_conditions_cache = Cache('cache/solar_conditions_cache') +solar_conditions = solar_conditions_cache.get('solar_conditions', SolarConditions()) web_server = None status_data = {} spot_providers = [] @@ -48,6 +49,7 @@ def shutdown(sig, frame): lookup_helper.stop() spots.close() alerts.close() + solar_conditions_cache.close() os._exit(0) @@ -120,7 +122,7 @@ if __name__ == '__main__': for entry in config.get("solar-condition-providers", []): solar_condition_providers.append(get_solar_conditions_provider_from_config(entry)) for p in solar_condition_providers: - p.setup(solar_conditions=solar_conditions) + p.setup(solar_conditions=solar_conditions, solar_conditions_cache=solar_conditions_cache) if p.enabled: p.start() diff --git a/templates/about.html b/templates/about.html index 039c098..4f95d0d 100644 --- a/templates/about.html +++ b/templates/about.html @@ -69,7 +69,7 @@
This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.
- + {% end %} \ No newline at end of file diff --git a/templates/add_spot.html b/templates/add_spot.html index afaff68..3c18416 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -69,8 +69,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/alerts.html b/templates/alerts.html index 1ebace6..ed836f1 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -70,8 +70,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/bands.html b/templates/bands.html index 3b14bb7..eba8349 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,9 +76,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index fe4bdde..e4b9506 100644 --- a/templates/base.html +++ b/templates/base.html @@ -24,7 +24,7 @@