feat: begin working on Onspring worker
This commit is contained in:
@@ -17,7 +17,7 @@ public class DatabaseWorker(
|
||||
|
||||
await UpdateDatabase();
|
||||
|
||||
using var scope = _serviceScopeFactory.CreateScope();
|
||||
using var scope = _serviceScopeFactory.CreateAsyncScope();
|
||||
var dbOptions = scope.ServiceProvider.GetRequiredService<DbOptions>();
|
||||
|
||||
_timer = _timeProvider.CreateTimer(
|
||||
@@ -40,10 +40,14 @@ public class DatabaseWorker(
|
||||
public void Dispose()
|
||||
{
|
||||
_timer?.Dispose();
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private async Task UpdateDatabase()
|
||||
{
|
||||
var updateIdProperty = LogContext.PushProperty("DatabaseUpdateId", Guid.NewGuid());
|
||||
|
||||
_logger.LogInformation("Updating database");
|
||||
|
||||
try
|
||||
@@ -63,5 +67,9 @@ public class DatabaseWorker(
|
||||
{
|
||||
_logger.LogError(ex, "Error updating database");
|
||||
}
|
||||
finally
|
||||
{
|
||||
updateIdProperty.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user