Move sidebar data back into hourly record generation

This commit is contained in:
April P. committed 2024-12-18 11:39:16 -08:00
1 parent 66e23fab61
commit a6fbf69a2e
2 files changed
+16 -33

No files matched your search

+1 -2
View File
@@ -37,9 +37,8 @@ public class Program
Task checkAlerts = TimedTasks.CheckForAlerts(locations, prioritySender);
Task hourlyRecordGen = TimedTasks.HourlyRecordCollection(locations, routineSender);
Task biHourlyRecordGen = TimedTasks.BiHourlyCollection(locations, routineSender);
Task cleanTempDir = TimedTasks.CleanTempDirectory();
await Task.WhenAll(checkAlerts, hourlyRecordGen, biHourlyRecordGen, cleanTempDir);
await Task.WhenAll(checkAlerts, hourlyRecordGen, cleanTempDir);
}
+15 -31
View File
@@ -66,14 +66,29 @@ public class TimedTasks
await new CurrentObservationsProduct().Populate(locations);
List<GenericResponse<DailyForecastResponse>> dfs = await new DailyForecastProduct().Populate(locations);
List<GenericResponse<HourlyForecastResponse>> hfs = await new HourlyForecastProduct().Populate(locations);
List<GenericResponse<AirQualityResponse>> aqs = await new AirQualityProduct().Populate(locations);
List<GenericResponse<PollenResponse>> pfs = await new PollenForecastProduct().Populate(locations);
List<GenericResponse<HeatingCoolingResponse>> hcs = await new HeatingCoolingProduct().Populate(locations);
List<GenericResponse<AchesPainResponse>> acps = await new AchesPainProduct().Populate(locations);
List<GenericResponse<BreathingResponse>> brs = await new BreathingProduct().Populate(locations);
string obsRecord = await new CurrentObsRecord().MakeRecord(obs);
string dfsRecord = await new DailyForecastRecord().MakeRecord(dfs);
string hfRecord = await new HourlyForecastRecord().MakeRecord(hfs);
string aqsRecord = await new AirQualityRecord().MakeRecord(aqs);
string pfsRecord = await new PollenRecord().MakeRecord(pfs);
string hcRecord = await new HeatingCoolingRecord().MakeRecord(hcs);
string acpsRecord = await new AchesPainRecord().MakeRecord(acps);
string brsRecord = await new BreathingRecord().MakeRecord(brs);
sender.SendFile(obsRecord, "storeData(QGROUP=__CurrentObservations__,Feed=CurrentObservations)");
sender.SendFile(dfsRecord, "storeData(QGROUP=__DailyForecast__,Feed=DailyForecast)");
sender.SendFile(hfRecord, "storeData(QGROUP=__HourlyForecast__,Feed=HourlyForecast)");
sender.SendFile(aqsRecord, "storeData(QGROUP=__AirQuality__,Feed=AirQuality)");
sender.SendFile(pfsRecord, "storeData(QGROUP=__PollenForecast__,Feed=PollenForecast)");
sender.SendFile(hcRecord, "storeData(QGROUP=__HeatingAndCooling__,Feed=HeatingAndCooling)");
sender.SendFile(acpsRecord, "storeData(QGROUP=__AchesAndPains__,Feed=AchesAndPains)");
sender.SendFile(brsRecord, "storeData(QGROUP=__Breathing__,Feed=Breathing)");
string nextTimestamp = DateTime.Now.AddHours(1).ToString("h:mm tt");
@@ -82,35 +97,4 @@ public class TimedTasks
await Task.Delay(3600 * 1000);
}
}
public static async Task BiHourlyCollection(string[] locations, UdpSender sender)
{
while (true)
{
Log.Info("Running bi-hourly record collection");
List<GenericResponse<AirQualityResponse>> aqs = await new AirQualityProduct().Populate(locations);
List<GenericResponse<PollenResponse>> pfs = await new PollenForecastProduct().Populate(locations);
List<GenericResponse<HeatingCoolingResponse>> hcs = await new HeatingCoolingProduct().Populate(locations);
List<GenericResponse<AchesPainResponse>> acps = await new AchesPainProduct().Populate(locations);
List<GenericResponse<BreathingResponse>> brs = await new BreathingProduct().Populate(locations);
string aqsRecord = await new AirQualityRecord().MakeRecord(aqs);
string pfsRecord = await new PollenRecord().MakeRecord(pfs);
string hcRecord = await new HeatingCoolingRecord().MakeRecord(hcs);
string acpsRecord = await new AchesPainRecord().MakeRecord(acps);
string brsRecord = await new BreathingRecord().MakeRecord(brs);
sender.SendFile(aqsRecord, "storeData(QGROUP=__AirQuality__,Feed=AirQuality)");
sender.SendFile(pfsRecord, "storeData(QGROUP=__PollenForecast__,Feed=PollenForecast)");
sender.SendFile(hcRecord, "storeData(QGROUP=__HeatingAndCooling__,Feed=HeatingAndCooling)");
sender.SendFile(acpsRecord, "storeData(QGROUP=__AchesAndPains__,Feed=AchesAndPains)");
sender.SendFile(brsRecord, "storeData(QGROUP=__Breathing__,Feed=Breathing)");
string nextTimeStamp = DateTime.Now.AddHours(2).ToString("h:mm tt");
Log.Info($"Next bi-hourly generation will be at {nextTimeStamp}");
await Task.Delay(7200 * 1000);
}
}
}