mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-06 02:21:42 +00:00
Refactor of caching & data storage part 1
This commit is contained in:
@@ -44,12 +44,12 @@ class GIROIonosonde(SolarConditionsProvider):
|
||||
stations.append({"ursi": row[0].strip(), "name": row[1].strip()})
|
||||
return stations
|
||||
|
||||
def setup(self, solar_conditions, solar_conditions_cache):
|
||||
def setup(self, solar_conditions):
|
||||
"""Pre-populate ionosonde_data with known station names for stations not already present,
|
||||
so the station dropdown is available before the first poll. Does not overwrite existing
|
||||
entries so KC2G cache data is preserved."""
|
||||
|
||||
super().setup(solar_conditions, solar_conditions_cache)
|
||||
super().setup(solar_conditions)
|
||||
existing = solar_conditions.ionosonde_data or {}
|
||||
new_entries = {
|
||||
s["ursi"]: {"ursi": s["ursi"], "name": s["name"], "fof2": None, "muf": None,
|
||||
|
||||
@@ -10,18 +10,16 @@ class SolarConditionsProvider:
|
||||
def __init__(self, name, provider_config):
|
||||
"""Constructor"""
|
||||
|
||||
self._solar_conditions_cache = None
|
||||
self.name = name
|
||||
self.enabled = provider_config["enabled"]
|
||||
self.last_update_time = datetime.min.replace(tzinfo=pytz.UTC)
|
||||
self.status = "Not Started" if self.enabled else "Disabled"
|
||||
self._solar_conditions = None
|
||||
|
||||
def setup(self, solar_conditions, solar_conditions_cache):
|
||||
"""Set up the provider, giving it the solar conditions object and its backing cache"""
|
||||
def setup(self, solar_conditions):
|
||||
"""Set up the provider, giving it the solar conditions object"""
|
||||
|
||||
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"""
|
||||
@@ -41,4 +39,3 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user