fix: follow live logs and reconcile duplicate managed mods
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Sync LobeHub models / sync (push) Has been cancelled

This commit is contained in:
Disy committed 2026-09-24 22:36:21 +08:00
1 parent c2bc7c2441
commit 19098f7159
10 files changed
+628 -125

No files matched your search

+21 -1
View File
@@ -86,6 +86,10 @@ const {
getHistoricalContent,
invalidate,
clearLive,
refreshLive,
flushLive,
acceptsProcessLogs,
resetLive,
} = useInstanceConsole(instanceId.value)
await hydrate()
@@ -217,6 +221,7 @@ if (!props.playing) {
const unlistenLog = await log_listener((payload) => {
if (payload.instance_id !== instanceId.value) return
if (!acceptsProcessLogs()) return
if (payload.type === 'log4j') {
liveConsole.addLog4jEvent(payload)
@@ -228,12 +233,14 @@ const unlistenLog = await log_listener((payload) => {
const unlistenProcesses = await process_listener(async (e) => {
if (e.instance_id !== instanceId.value) return
if (e.event === 'launched') {
liveConsole.clear()
resetLive()
clearCrashAnalysis()
invalidate()
selectedLogIndex.value = 0
}
if (e.event === 'finished') {
await refreshLive().catch(console.warn)
flushLive()
invalidate()
const freshLogs = await getHistoricalLogs()
logs.value = buildLogList(freshLogs)
@@ -241,7 +248,20 @@ const unlistenProcesses = await process_listener(async (e) => {
}
})
// Keep following the file even when a mod stops writing to stdout after startup.
// Schedule after each read so slow disk/IPC cannot pile up concurrent requests.
let disposed = false
let refreshTimer
async function followLatestLog() {
await refreshLive().catch(console.warn)
if (!props.playing) flushLive()
if (!disposed) refreshTimer = setTimeout(followLatestLog, 1000)
}
void followLatestLog()
onUnmounted(() => {
disposed = true
clearTimeout(refreshTimer)
unlistenLog()
unlistenProcesses()
})