mirror of https://github.com/apache/nifi.git
[NIFI-7358] - Fix: Sorting on 'Estimated Time to Back Pressure' in the Connection summary table does not work properly
- fix style issues - review feedback This closes #4208
This commit is contained in:
parent
9df53e7204
commit
c263daf20b
|
@ -2301,6 +2301,29 @@
|
|||
|
||||
var sortState = {};
|
||||
|
||||
var getMinTimeToBackPressure = function (connection) {
|
||||
var maxCurrentUsage = Math.max(_.get(connection, 'percentUseBytes', 0), _.get(connection, 'percentUseCount', 0));
|
||||
|
||||
if (maxCurrentUsage >= 100) {
|
||||
// currently experiencing back pressure
|
||||
return 0;
|
||||
}
|
||||
|
||||
var bytesPrediction = _.get(connection, 'predictions.predictedMillisUntilBytesBackpressure', -1);
|
||||
var countPrediction = _.get(connection, 'predictions.predictedMillisUntilCountBackpressure', -1);
|
||||
|
||||
if (bytesPrediction < 0) {
|
||||
// bytes prediction is unknown. return the count prediction if known, otherwise use the max
|
||||
return countPrediction < 0 ? Number.MAX_VALUE : countPrediction;
|
||||
} else if (countPrediction < 0) {
|
||||
// count prediction is unknown but we know bytes prediction is known, return that
|
||||
return bytesPrediction;
|
||||
}
|
||||
|
||||
// if we get here, both predictions are known. return the minimum of the two
|
||||
return Math.min(bytesPrediction, countPrediction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the specified data using the specified sort details.
|
||||
*
|
||||
|
@ -2361,19 +2384,8 @@
|
|||
return aPercentUseDataSize - bPercentUseDataSize;
|
||||
}
|
||||
} else if (sortDetails.columnId === 'backpressurePrediction') {
|
||||
// if the connection is at backpressure currently, "now" displays and not the estimate. Should account for that when sorting.
|
||||
var aMaxCurrentUsage = Math.max(_.get(a, 'percentUseBytes', 0), _.get(a, 'percentUseCount', 0));
|
||||
var bMaxCurrentUsage = Math.max(_.get(b, 'percentUseBytes', 0), _.get(b, 'percentUseCount', 0));
|
||||
|
||||
var aMinTime = Math.min(_.get(a, 'predictions.predictedMillisUntilBytesBackpressure', Number.MAX_VALUE), _.get(a, 'predictions.predictedMillisUntilCountBackpressure', Number.MAX_VALUE));
|
||||
var bMinTime = Math.min(_.get(b, 'predictions.predictedMillisUntilBytesBackpressure', Number.MAX_VALUE), _.get(b, 'predictions.predictedMillisUntilCountBackpressure', Number.MAX_VALUE));
|
||||
|
||||
if (aMaxCurrentUsage >= 100) {
|
||||
aMinTime = 0;
|
||||
}
|
||||
if (bMaxCurrentUsage >= 100) {
|
||||
bMinTime = 0;
|
||||
}
|
||||
var aMinTime = getMinTimeToBackPressure(a);
|
||||
var bMinTime = getMinTimeToBackPressure(b);
|
||||
|
||||
return aMinTime - bMinTime;
|
||||
} else if (sortDetails.columnId === 'sent' || sortDetails.columnId === 'received' || sortDetails.columnId === 'input' || sortDetails.columnId === 'output' || sortDetails.columnId === 'transferred') {
|
||||
|
|
Loading…
Reference in New Issue