forked from ddrilling/AsbCloudServer
Fix TelemetryDataCache<TDto>.InitializeCacheFromDBAsync
This commit is contained in:
parent
26f01eb236
commit
8d17a88f3d
@ -163,15 +163,16 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
private async Task InitializeCacheFromDBAsync<TEntity>(IAsbCloudDbContext db, Action<string, double?> onProgress, CancellationToken token)
|
private async Task InitializeCacheFromDBAsync<TEntity>(IAsbCloudDbContext db, Action<string, double?> onProgress, CancellationToken token)
|
||||||
where TEntity : class, AsbCloudDb.Model.ITelemetryData
|
where TEntity : class, AsbCloudDb.Model.ITelemetryData
|
||||||
{
|
{
|
||||||
|
var defaultTimeout = db.Database.GetCommandTimeout();
|
||||||
|
db.Database.SetCommandTimeout(TimeSpan.FromMinutes(5));
|
||||||
|
|
||||||
|
if (isLoading)
|
||||||
|
throw new Exception("Multiple cache loading detected.");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (isLoading)
|
|
||||||
throw new Exception("Multiple cache loading detected.");
|
|
||||||
|
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
db.Database.SetCommandTimeout(TimeSpan.FromMinutes(5));
|
|
||||||
|
|
||||||
Well[] wells = await db.Set<Well>()
|
Well[] wells = await db.Set<Well>()
|
||||||
.Include(well => well.Telemetry)
|
.Include(well => well.Telemetry)
|
||||||
.Include(well => well.Cluster)
|
.Include(well => well.Cluster)
|
||||||
@ -198,7 +199,6 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
var defaultTimeout = db.Database.GetCommandTimeout();
|
|
||||||
db.Database.SetCommandTimeout(defaultTimeout);
|
db.Database.SetCommandTimeout(defaultTimeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user