perf: reduce warnings caused by network connection failures (#252)

This commit is contained in:
Lykin 2024-05-17 14:43:43 +08:00
parent abf5534165
commit 4dd52a8c8e
2 changed files with 9 additions and 6 deletions

View File

@ -80,9 +80,11 @@ const refreshInfo = async (force) => {
}
if (!isEmpty(props.server) && browserStore.isConnected(props.server)) {
try {
const info = await browserStore.getServerInfo(props.server)
serverInfo.value = info
_updateChart(info)
const info = await browserStore.getServerInfo(props.server, true)
if (!isEmpty(info)) {
serverInfo.value = info
_updateChart(info)
}
} finally {
pageState.loading = false
pageState.autoLoading = false

View File

@ -343,10 +343,11 @@ const useBrowserStore = defineStore('browser', {
/**
*
* @param server
* @param {string} server
* @param {boolean} mute
* @returns {Promise<{}>}
*/
async getServerInfo(server) {
async getServerInfo(server, mute) {
try {
const { success, data, msg } = await ServerInfo(server)
if (success) {
@ -356,7 +357,7 @@ const useBrowserStore = defineStore('browser', {
serverInst.stats = data
}
return data
} else if (!isEmpty(msg)) {
} else if (!isEmpty(msg) && mute !== true) {
$message.warning(msg)
}
} finally {