Skip to content
Snippets Groups Projects
Commit 33886acd authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

Create Testing Branch

parent 7905a050
No related branches found
No related tags found
No related merge requests found
Pipeline #445197 passed
......@@ -17,8 +17,6 @@ namespace Coscine.KpiGenerator
ConsulConfiguration configuration = new ConsulConfiguration();
DataConnection.DefaultSettings = new CoscineSettings(configuration);
var liveMode = configuration.GetStringAndWait("coscine/global/reporting/live");
// Run all Generators for the KPI
// each Generator returns a list of KPI, it can have zero entries.
List<Kpi> newKpis = new List<Kpi>();
......@@ -27,29 +25,9 @@ namespace Coscine.KpiGenerator
newKpis.AddRange(new GenerateRDSQuotasPerIkz(configuration, "2973").GenerateKpis());
newKpis.AddRange(new GenerateUsersPerIkz(configuration, "2967").GenerateKpis());
// when all generators are done
var kpiModel = new KpiModel();
// each value is stored within the database
foreach (Kpi kpi in newKpis)
{
kpiModel.Insert(kpi);
}
// get all values from the database that have not been successfully sent yet
var kpiToProcess = kpiModel.GetAllWhere((kpi) => (kpi.SentSuccessfully == false)).ToList();
// try to sent them
HamsterReporter hamsterReporter = new HamsterReporter(configuration);
if (liveMode == "1")
{
hamsterReporter.Send(kpiToProcess);
}
// if the kpi were sent successful mark all values within the database as successfully sent
foreach (Kpi kpi in kpiToProcess)
{
kpiModel.MarkAsSent(kpi);
}
hamsterReporter.Send(newKpis);
}
}
}
......@@ -17,7 +17,7 @@ namespace Coscine.KpiGenerator.Reporter
public HamsterReporter(IConfiguration configuration)
{
_password = configuration.GetStringAndWait("coscine/global/reporting/password");
_liveMode = configuration.GetStringAndWait("coscine/global/reporting/live");
_liveMode = "0";
_restClient = new RestClient();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment