Sqlite Data Source angepasst
This commit is contained in:
@@ -16,26 +16,21 @@ public class DatabaseCheck : BackgroundService
|
|||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
var timer = new PeriodicTimer(TimeSpan.FromSeconds(30));
|
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1800));
|
||||||
|
|
||||||
while (await timer.WaitForNextTickAsync(stoppingToken))
|
while (await timer.WaitForNextTickAsync(stoppingToken))
|
||||||
{
|
{
|
||||||
// Hintergrundprozess abwarten
|
// Hintergrundprozess abwarten
|
||||||
// await checkDatabaseConnection();
|
|
||||||
await checkDatabaseIntegrity();
|
await checkDatabaseIntegrity();
|
||||||
// 5 Sekdunden Offset
|
// 5 Sekdunden Offset
|
||||||
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
|
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task checkDatabaseConnection()
|
// String sqliteConnectionString als Argument übergeben
|
||||||
|
public Task checkDatabaseIntegrity()
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
using var conn = new SqliteConnection("Data Source=./persistence/watcher.db");
|
||||||
}
|
|
||||||
|
|
||||||
public Task checkDatabaseIntegrity(String sqliteConnectionString)
|
|
||||||
{
|
|
||||||
using var conn = new SqliteConnection(sqliteConnectionString);
|
|
||||||
_logger.LogInformation("Sqlite Integrity-Check started...");
|
_logger.LogInformation("Sqlite Integrity-Check started...");
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -62,6 +57,8 @@ public class DatabaseCheck : BackgroundService
|
|||||||
{
|
{
|
||||||
conn.Close();
|
conn.Close();
|
||||||
_logger.LogError(e.Message);
|
_logger.LogError(e.Message);
|
||||||
|
|
||||||
|
// TODO: LogEvent erstellen
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Database Integrity-Check finished.");
|
_logger.LogInformation("Database Integrity-Check finished.");
|
||||||
|
@@ -48,6 +48,8 @@ public class NetworkCheck : BackgroundService
|
|||||||
{
|
{
|
||||||
_DashboardStore.NetworkStatus = "offline";
|
_DashboardStore.NetworkStatus = "offline";
|
||||||
_logger.LogError("Ping failed. Watcher appears to have no network connection.");
|
_logger.LogError("Ping failed. Watcher appears to have no network connection.");
|
||||||
|
|
||||||
|
// LogEvent erstellen
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Networkcheck finished.");
|
_logger.LogInformation("Networkcheck finished.");
|
||||||
|
Reference in New Issue
Block a user