forked from ddrilling/AsbCloudServer
OperationDetectionBackgroundService remove statistic for optimization.
This commit is contained in:
parent
383e27d230
commit
d45145b8a5
@ -132,24 +132,13 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
|
|||||||
var startDate = begin;
|
var startDate = begin;
|
||||||
var detectedOperations = new List<DetectedOperation>(8);
|
var detectedOperations = new List<DetectedOperation>(8);
|
||||||
|
|
||||||
var dbRequests_ = 0;
|
|
||||||
var dbTime_ = 0d;
|
|
||||||
var sw_ = new Stopwatch();
|
|
||||||
var otherTime_ = 0d;
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
sw_.Restart();
|
|
||||||
var data = await query
|
var data = await query
|
||||||
.Where(d => d.DateTime > startDate)
|
.Where(d => d.DateTime > startDate)
|
||||||
.Take(take)
|
.Take(take)
|
||||||
.ToArrayAsync(token);
|
.ToArrayAsync(token);
|
||||||
|
|
||||||
sw_.Stop();
|
|
||||||
dbTime_ += sw_.ElapsedMilliseconds;
|
|
||||||
dbRequests_++;
|
|
||||||
sw_.Restart();
|
|
||||||
|
|
||||||
if (data.Length < minFragmentLength)
|
if (data.Length < minFragmentLength)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -182,16 +171,9 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
|
|||||||
skip += minStepLength;
|
skip += minStepLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
sw_.Stop();
|
|
||||||
otherTime_ += sw_.ElapsedMilliseconds;
|
|
||||||
|
|
||||||
if (!isDetected)
|
if (!isDetected)
|
||||||
{
|
{
|
||||||
if (data.Length < take)
|
startDate = startDate.AddSeconds(0.95 * take);
|
||||||
break;
|
|
||||||
|
|
||||||
var lastPartDate = data.Last().DateTime;
|
|
||||||
startDate = startDate + (0.75 * (lastPartDate - startDate));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user