forked from ddrilling/AsbCloudServer
Fix TelemetryTracker dbContext disposing.
This commit is contained in:
parent
6412c24a3e
commit
a74032eed5
@ -44,7 +44,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
||||||
.UseNpgsql(configuration.GetConnectionString("DefaultConnection"))
|
.UseNpgsql(configuration.GetConnectionString("DefaultConnection"))
|
||||||
.Options;
|
.Options;
|
||||||
using var db = new AsbCloudDbContext(options);
|
var db = new AsbCloudDbContext(options);
|
||||||
|
|
||||||
var cacheTelemetry = cacheDb.GetCachedTable<Telemetry>(db);
|
var cacheTelemetry = cacheDb.GetCachedTable<Telemetry>(db);
|
||||||
var keyValuePairs = new Dictionary<string, TrackerStat>(cacheTelemetry.Count());
|
var keyValuePairs = new Dictionary<string, TrackerStat>(cacheTelemetry.Count());
|
||||||
@ -78,8 +78,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
.ToListAsync()
|
.ToListAsync()
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
db.Dispose();
|
|
||||||
|
|
||||||
var oldReqs = dates.Select(t => new
|
var oldReqs = dates.Select(t => new
|
||||||
{
|
{
|
||||||
Uid = cacheTelemetry.FirstOrDefault(c => c.Id == t.IdTelemetry)?.RemoteUid,
|
Uid = cacheTelemetry.FirstOrDefault(c => c.Id == t.IdTelemetry)?.RemoteUid,
|
||||||
@ -94,6 +92,10 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
telemetryStat.TelemetryDateMax = oldReq.DateMax;
|
telemetryStat.TelemetryDateMax = oldReq.DateMax;
|
||||||
telemetryStat.LastTimeServer = oldReq.DateMax;
|
telemetryStat.LastTimeServer = oldReq.DateMax;
|
||||||
}
|
}
|
||||||
|
}).ContinueWith((t) =>
|
||||||
|
{
|
||||||
|
db.Dispose();
|
||||||
|
return t;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,9 +58,6 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
public async Task<IActionResult> GetClusterRopStatByUidAsync([FromRoute] string uid,
|
public async Task<IActionResult> GetClusterRopStatByUidAsync([FromRoute] string uid,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
// if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false))
|
|
||||||
// return Forbid();
|
|
||||||
|
|
||||||
var result = await operationsStatService.GetRopStatByUidAsync(
|
var result = await operationsStatService.GetRopStatByUidAsync(
|
||||||
uid, token).ConfigureAwait(false);
|
uid, token).ConfigureAwait(false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user