fix: optimize MBE start flow - skip redundant frontend polling

- Backend already polls 60s for MBE port readiness
- Frontend no longer polls 30s after backend returns
- Total wait time: ~60s instead of ~90s
- Start timeout set to 60s for MBE
This commit is contained in:
2026-10-23 01:31:50 +08:00
parent c21c186e0c
commit 6e0e306082

View File

@@ -761,13 +761,22 @@ async function startService(name: string) {
const started = typeof result === 'string' ? result === 'started' : result?.result === 'started'
s.result.value = started ? (name === 'mbe' ? 'Loading model...' : 'Service started') : JSON.stringify(result)
s.ok.value = started
// Poll up to 30s for the service to pass health check
for (let i = 0; i < 15; i++) {
await new Promise(r => setTimeout(r, 2000))
// For MBE, backend already polls for 60s, just test once
if (name !== 'mbe') {
// Poll up to 30s for the service to pass health check
for (let i = 0; i < 15; i++) {
await new Promise(r => setTimeout(r, 2000))
await s.test()
if (s.status.value === 'online') {
s.result.value = 'Service started'
break
}
}
} else {
// MBE: test once after backend returns
await s.test()
if (s.status.value === 'online') {
s.result.value = 'Service started'
break
}
}
} catch (e: any) {