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)) { if (!isEmpty(props.server) && browserStore.isConnected(props.server)) {
try { try {
const info = await browserStore.getServerInfo(props.server) const info = await browserStore.getServerInfo(props.server, true)
serverInfo.value = info if (!isEmpty(info)) {
_updateChart(info) serverInfo.value = info
_updateChart(info)
}
} finally { } finally {
pageState.loading = false pageState.loading = false
pageState.autoLoading = false pageState.autoLoading = false

View File

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