Throttle journalctl restarts
This addresses an issue with typeahead search generating a significant load on the system, a single filter test run can make ~100 calls to journalctl restart if not throttled.
This commit is contained in:
parent
6379950582
commit
d038d2bd55
2 changed files with 8 additions and 2 deletions
|
|
@ -58,6 +58,7 @@
|
|||
"raw-loader": "^0.5.1",
|
||||
"react": "16.13.1",
|
||||
"react-dom": "16.13.1",
|
||||
"throttle-debounce": "2.3.0",
|
||||
"xterm": "^3.14.5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ import {
|
|||
SearchIcon
|
||||
} from "@patternfly/react-icons";
|
||||
import { global_danger_color_200 } from "@patternfly/react-tokens";
|
||||
import { debounce } from 'throttle-debounce';
|
||||
|
||||
const $ = require("jquery");
|
||||
const cockpit = require("cockpit");
|
||||
|
|
@ -741,6 +742,11 @@ export default class View extends React.Component {
|
|||
this.setState({ recordingList: [] });
|
||||
}
|
||||
|
||||
throttleJournalRestart = debounce(300, () => {
|
||||
this.clearRecordings();
|
||||
this.journalctlRestart();
|
||||
});
|
||||
|
||||
handleInputChange(name, value) {
|
||||
const state = {};
|
||||
state[name] = value;
|
||||
|
|
@ -793,8 +799,7 @@ export default class View extends React.Component {
|
|||
this.state.hostname !== prevState.hostname ||
|
||||
this.state.search !== prevState.search
|
||||
) {
|
||||
this.clearRecordings();
|
||||
this.journalctlRestart();
|
||||
this.throttleJournalRestart();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue