diff --git a/client/src/store/historyStore/model/watchHistory.js b/client/src/store/historyStore/model/watchHistory.js index 81ab4972ad92..f04ceb582a69 100644 --- a/client/src/store/historyStore/model/watchHistory.js +++ b/client/src/store/historyStore/model/watchHistory.js @@ -19,6 +19,9 @@ import { useDatasetStore } from "@/stores/datasetStore"; const limit = 1000; +const ACTIVE_POLLING_INTERVAL = 3000; +const INACTIVE_POLLING_INTERVAL = 60000; + // last time the history has changed let lastUpdateTime = null; @@ -26,8 +29,8 @@ let lastUpdateTime = null; let lastRequestDate = new Date(); const { startWatchingResource: startWatchingHistory } = useResourceWatcher(watchHistory, { - shortPollingInterval: 3000, - longPollingInterval: 60000, + shortPollingInterval: ACTIVE_POLLING_INTERVAL, + longPollingInterval: INACTIVE_POLLING_INTERVAL, }); export { startWatchingHistory }; diff --git a/client/src/stores/entryPointStore.ts b/client/src/stores/entryPointStore.ts index 081f29742201..e59b6fefeeae 100644 --- a/client/src/stores/entryPointStore.ts +++ b/client/src/stores/entryPointStore.ts @@ -7,6 +7,8 @@ import { useResourceWatcher } from "@/composables/resourceWatcher"; import { getAppRoot } from "@/onload/loadConfig"; import { rethrowSimple } from "@/utils/simple-error"; +const ACTIVE_POLLING_INTERVAL = 10000; + // TODO: replace with the corresponding autogenerated model when ready interface EntryPoint { model_class: "InteractiveToolEntryPoint"; @@ -22,8 +24,8 @@ interface EntryPoint { export const useEntryPointStore = defineStore("entryPointStore", () => { const { startWatchingResource: startWatchingEntryPoints } = useResourceWatcher(fetchEntryPoints, { - shortPollingInterval: 10000, - enableBackgroundPolling: false, //No need to poll when the user is not on the page + shortPollingInterval: ACTIVE_POLLING_INTERVAL, + enableBackgroundPolling: false, // No need to poll in the background }); const entryPoints = ref([]); diff --git a/client/src/stores/notificationsStore.ts b/client/src/stores/notificationsStore.ts index e11ed7117d29..49a58eac7efc 100644 --- a/client/src/stores/notificationsStore.ts +++ b/client/src/stores/notificationsStore.ts @@ -12,10 +12,13 @@ import { mergeObjectListsById } from "@/utils/utils"; import { useBroadcastsStore } from "./broadcastsStore"; +const ACTIVE_POLLING_INTERVAL = 5000; +const INACTIVE_POLLING_INTERVAL = 30000; + export const useNotificationsStore = defineStore("notificationsStore", () => { const { startWatchingResource: startWatchingNotifications } = useResourceWatcher(getNotificationStatus, { - shortPollingInterval: 5000, - longPollingInterval: 30000, + shortPollingInterval: ACTIVE_POLLING_INTERVAL, + longPollingInterval: INACTIVE_POLLING_INTERVAL, }); const broadcastsStore = useBroadcastsStore();