fix(webui): stuck log reads surface as errors, not eternal loading
A keyed read whose request never settles pinned the panel's loading line forever; after a quiet minute the read is declared broken so the retry button appears, and the started-dedupe is released so it can run again. Also drops the download button from the log's empty state -- a log with nothing recorded has nothing to download -- and the leftover imports from the empty-state cuts.
This commit is contained in:
1 parent
39b85e572a
commit
8a14ee7797
5 files changed
+26
-20
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
|
||||
import ChangeCapture from "./ChangeCapture.vue";
|
||||
import PanelError from "./PanelError.vue";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { computed } from "vue";
|
||||
|
||||
import LogRow from "@/base/LogRow.vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { api } from "@/lib/api";
|
||||
|
||||
import PanelLoading from "./PanelLoading.vue";
|
||||
@@ -129,11 +129,6 @@ const download = computed(() =>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Nothing recorded</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
<EmptyContent v-if="download">
|
||||
<Button variant="outline" size="sm" as-child>
|
||||
<a :href="download" download>Download log</a>
|
||||
</Button>
|
||||
</EmptyContent>
|
||||
</Empty>
|
||||
|
||||
<template v-else>
|
||||
|
||||
@@ -147,11 +147,22 @@ export function provideTaskRun(id: ComputedRef<number | null>): TaskRun {
|
||||
if (started.has(cacheKey) && !force) return;
|
||||
started.add(cacheKey);
|
||||
cache.value = new Map(cache.value).set(cacheKey, undefined);
|
||||
fetcher()
|
||||
// A read that never settles would pin the panel's loading line forever:
|
||||
// after a quiet minute the read is declared broken so the retry button
|
||||
// can appear. A late response after the timeout is discarded by the race.
|
||||
let timedOut = false;
|
||||
const timeout = new Promise<never>((_, reject) => {
|
||||
setTimeout(() => {
|
||||
timedOut = true;
|
||||
reject(new Error("read timed out"));
|
||||
}, 30_000);
|
||||
});
|
||||
Promise.race([fetcher(), timeout])
|
||||
.then((res) => {
|
||||
cache.value = new Map(cache.value).set(cacheKey, res);
|
||||
})
|
||||
.catch(() => {
|
||||
if (!timedOut) started.delete(cacheKey);
|
||||
cache.value = new Map(cache.value).set(cacheKey, null);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user