mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed excessive CPU usage by stopping the indefinite growth of the graph dataset. Fixes #5794
This commit is contained in:
parent
f8f00b4ecf
commit
8c2e965f6e
@ -35,4 +35,5 @@ Bug fixes
|
||||
| `Issue #5765 <https://redmine.postgresql.org/issues/5765>`_ - Fixed an issue in the query tool when columns are having the same name as javascript object internal functions.
|
||||
| `Issue #5766 <https://redmine.postgresql.org/issues/5766>`_ - Fixed string indices must be integers issue for PostgreSQL < 9.3.
|
||||
| `Issue #5773 <https://redmine.postgresql.org/issues/5773>`_ - Fixed an issue where the application ignores the fixed port configuration value.
|
||||
| `Issue #5775 <https://redmine.postgresql.org/issues/5775>`_ - Ensure that 'setup-web.sh' should work in Debian 10.
|
||||
| `Issue #5775 <https://redmine.postgresql.org/issues/5775>`_ - Ensure that 'setup-web.sh' should work in Debian 10.
|
||||
| `Issue #5794 <https://redmine.postgresql.org/issues/5794>`_ - Fixed excessive CPU usage by stopping the indefinite growth of the graph dataset.
|
@ -67,7 +67,6 @@ export function getStatsUrl(sid=-1, did=-1, chart_names=[]) {
|
||||
* data to get the new state.
|
||||
*/
|
||||
export function statsReducer(state, action) {
|
||||
let newState = {};
|
||||
|
||||
if(action.reset) {
|
||||
return action.reset;
|
||||
@ -82,21 +81,14 @@ export function statsReducer(state, action) {
|
||||
}
|
||||
|
||||
Object.keys(action.incoming).forEach(label => {
|
||||
if(state[label]) {
|
||||
if(state[label].length >= X_AXIS_LENGTH) {
|
||||
state[label].unshift();
|
||||
}
|
||||
newState[label] = [
|
||||
action.counter ? action.incoming[label] - action.counterData[label] : action.incoming[label],
|
||||
...state[label],
|
||||
];
|
||||
} else {
|
||||
newState[label] = [
|
||||
action.counter ? action.incoming[label] - action.counterData[label] : action.incoming[label],
|
||||
];
|
||||
let newEle = action.counter ? action.incoming[label] - action.counterData[label] : action.incoming[label];
|
||||
state[label] = state[label] || [];
|
||||
if(state[label].length >= X_AXIS_LENGTH) {
|
||||
state[label].pop();
|
||||
}
|
||||
state[label].unshift(newEle);
|
||||
});
|
||||
return newState;
|
||||
return state;
|
||||
}
|
||||
|
||||
const chartsDefault = {
|
||||
@ -263,6 +255,7 @@ export function GraphsWrapper(props) {
|
||||
const toStatsLegendRef = useRef();
|
||||
const bioStatsLegendRef = useRef();
|
||||
const options = useMemo(()=>({
|
||||
normalized: true,
|
||||
legendCallback: legendCallback,
|
||||
animation: {
|
||||
duration: 0,
|
||||
@ -385,4 +378,4 @@ GraphsWrapper.propTypes = {
|
||||
showTooltip: PropTypes.bool.isRequired,
|
||||
showDataPoints: PropTypes.bool.isRequired,
|
||||
isDatabase: PropTypes.bool.isRequired,
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user