summaryrefslogtreecommitdiff
path: root/src/store/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/store/plugins')
-rw-r--r--src/store/plugins/WebSocketPlugin.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/store/plugins/WebSocketPlugin.js b/src/store/plugins/WebSocketPlugin.js
index 965c32c9..400fdefa 100644
--- a/src/store/plugins/WebSocketPlugin.js
+++ b/src/store/plugins/WebSocketPlugin.js
@@ -1,3 +1,5 @@
+import { debounce } from 'lodash';
+
/**
* WebSocketPlugin will allow us to get new data from the server
* without having to poll for changes on the frontend.
@@ -26,23 +28,21 @@ const WebSocketPlugin = store => {
ws.onerror = event => {
console.error(event);
};
- ws.onmessage = event => {
+ ws.onmessage = debounce(event => {
const data = JSON.parse(event.data);
const eventInterface = data.interface;
+ const path = data.path;
if (eventInterface === 'xyz.openbmc_project.State.Host') {
const { properties: { CurrentHostState } = {} } = data;
store.commit('global/setHostStatus', CurrentHostState);
- } else {
- const { interfaces, event } = data;
- if (event === 'InterfacesAdded' && interfaces) {
- // Checking for 'InterfacesAdded' events
- // since they have all properties needed to
- // change health status
- store.dispatch('eventLog/checkHealth', interfaces);
- }
+ } else if (path === '/xyz/openbmc_project/logging') {
+ store.dispatch('eventLog/getEventLogData');
}
- };
+ // 2.5 sec debounce to avoid making multiple consecutive
+ // GET requests since log related server messages seem to
+ // come in clusters
+ }, 2500);
};
store.subscribe(({ type }) => {