fix TelemetryAnalyticsService.AnalyzeAndSaveTelemetriesAsync().

This commit is contained in:
Фролов 2021-11-22 14:04:05 +05:00
parent f4f4974cdd
commit 809ee137aa
4 changed files with 35 additions and 7 deletions

View File

@ -231,13 +231,9 @@ namespace AsbCloudInfrastructure.Services.Analysis
public async Task AnalyzeAndSaveTelemetriesAsync(CancellationToken token = default) public async Task AnalyzeAndSaveTelemetriesAsync(CancellationToken token = default)
{ {
var allTelemetryIds = await db.TelemetryDataSaub var allTelemetryIds = await db.Telemetries.Select(t => t.Id).ToListAsync(token).ConfigureAwait(false);
.Select(t => t.IdTelemetry)
.Distinct()
.ToListAsync(token)
.ConfigureAwait(false);
foreach(var idTelemetry in allTelemetryIds) foreach (var idTelemetry in allTelemetryIds)
{ {
var analyzeStartDate = await GetLastAnalysisDateAsync(idTelemetry, token).ConfigureAwait(false); var analyzeStartDate = await GetLastAnalysisDateAsync(idTelemetry, token).ConfigureAwait(false);
await AnalyseAndSaveTelemetryAsync(idTelemetry, analyzeStartDate, token).ConfigureAwait(false); await AnalyseAndSaveTelemetryAsync(idTelemetry, analyzeStartDate, token).ConfigureAwait(false);

View File

@ -7,6 +7,7 @@ namespace AsbCloudWebApi
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
//new TraceListenerView(); // to trace mysterious errors
CreateHostBuilder(args).Build().Run(); CreateHostBuilder(args).Build().Run();
} }

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace AsbCloudWebApi
{
public class TraceListenerView : TraceListener
{
public TraceListenerView()
{
Trace.Listeners.Add(this);
}
public override void Write(object o)
{
base.Write(o);
}
public override void Write(string message)
{
//throw new NotImplementedException();
}
public override void WriteLine(string message)
{
//throw new NotImplementedException();
}
}
}

View File

@ -7,7 +7,7 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", "DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
"DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True", "DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
"ServerConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True", "ServerConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
"LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True" "LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"