Various fixes (#186)

* fix: #181

* fix: use taskHandler as source of truth for imports

* fix: task formatting

* fix: zip downloads

* feat: re-enable import version button on delete + lint
This commit is contained in:
DecDuck
2025-08-15 22:57:56 +10:00
committed by GitHub
parent 9ff541059d
commit abec952e39
14 changed files with 180 additions and 185 deletions

View File

@ -73,6 +73,8 @@ class TaskHandler {
}
async create(task: Task) {
if (this.hasTask(task.id)) throw new Error("Task with ID already exists.");
let updateCollectTimeout: NodeJS.Timeout | undefined;
let updateCollectResolves: Array<(value: unknown) => void> = [];
let logOffset: number = 0;
@ -206,8 +208,6 @@ class TaskHandler {
};
}
if (task.finally) await task.finally();
taskEntry.endTime = new Date().toISOString();
await updateAllClients();
@ -247,7 +247,10 @@ class TaskHandler {
) {
const task =
this.taskPool.get(taskId) ??
(await prisma.task.findUnique({ where: { id: taskId } }));
(await prisma.task.findFirst({
where: { id: taskId },
orderBy: { started: "desc" },
}));
if (!task) {
peer.send(
`error/${taskId}/Unknown task/Drop couldn't find the task you're looking for.`,
@ -324,6 +327,10 @@ class TaskHandler {
.toArray();
}
hasTask(id: string) {
return this.taskPool.has(id);
}
dailyTasks() {
return this.dailyScheduledTasks;
}
@ -429,7 +436,6 @@ export interface Task {
taskGroup: TaskGroup;
name: string;
run: (context: TaskRunContext) => Promise<void>;
finally?: () => Promise<void> | void;
acls: GlobalACL[];
}