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