Sqlite Data Source angepasst
This commit is contained in:
@@ -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.");
|
||||
|
@@ -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.");
|
||||
|
Reference in New Issue
Block a user