优化刷盘显示

This commit is contained in:
2026-04-10 15:21:56 +08:00
parent e256b65f10
commit 9cc03ee749
2 changed files with 15 additions and 2 deletions
+8 -2
View File
@@ -1,6 +1,6 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { fetchStats, flushIndex, fetchWorkers, setWorkers, fetchBacklink, triggerBacklink, fetchPriorityStatus } from '../api.js'
import { fetchStats, flushIndex, fetchFlushStatus, fetchWorkers, setWorkers, fetchBacklink, triggerBacklink, fetchPriorityStatus } from '../api.js'
const stats = ref(null)
const loading = ref(true)
@@ -131,7 +131,13 @@ async function doFlush() {
flushing.value = true
try {
await flushIndex()
// 重新拉取 statspending 应该归零
// 轮询刷盘状态,直到完成
while (true) {
await new Promise(r => setTimeout(r, 500)) // 等待 500ms
const status = await fetchFlushStatus()
if (!status.flushing) break
}
// 刷盘完成,重新拉取 stats
stats.value = await fetchStats()
} catch (e) {
error.value = '刷盘失败: ' + e.message