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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user