feature/db-check #21

Merged
triggermeelmo merged 8 commits from feature/db-check into development 2025-10-03 13:11:18 +02:00
2 changed files with 8 additions and 9 deletions
Showing only changes of commit 2e9d41fe60 - Show all commits

View File

@@ -16,26 +16,21 @@ public class DatabaseCheck : BackgroundService
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))
{
// Hintergrundprozess abwarten
// await checkDatabaseConnection();
await checkDatabaseIntegrity();
// 5 Sekdunden Offset
await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
}
}
public Task checkDatabaseConnection()
// String sqliteConnectionString als Argument übergeben
public Task checkDatabaseIntegrity()
{
return Task.CompletedTask;
}
public Task checkDatabaseIntegrity(String sqliteConnectionString)
{
using var conn = new SqliteConnection(sqliteConnectionString);
using var conn = new SqliteConnection("Data Source=./persistence/watcher.db");
_logger.LogInformation("Sqlite Integrity-Check started...");
try
@@ -62,6 +57,8 @@ public class DatabaseCheck : BackgroundService
{
conn.Close();
_logger.LogError(e.Message);
// TODO: LogEvent erstellen
}
_logger.LogInformation("Database Integrity-Check finished.");

View File

@@ -48,6 +48,8 @@ public class NetworkCheck : BackgroundService
{
_DashboardStore.NetworkStatus = "offline";
_logger.LogError("Ping failed. Watcher appears to have no network connection.");
// LogEvent erstellen
}
_logger.LogInformation("Networkcheck finished.");