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'
|
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
|
||||||
// Poll up to 30s for the service to pass health check
|
// For MBE, backend already polls for 60s, just test once
|
||||||
for (let i = 0; i < 15; i++) {
|
if (name !== 'mbe') {
|
||||||
await new Promise(r => setTimeout(r, 2000))
|
// 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()
|
await s.test()
|
||||||
if (s.status.value === 'online') {
|
if (s.status.value === 'online') {
|
||||||
s.result.value = 'Service started'
|
s.result.value = 'Service started'
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user