mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-01 11:31:51 +08:00
fix: harden task runtime across restart and terminal mirror
Clear open run segments on process start without imputing downtime. Mirror terminal/pause runtime fields into memory before hydration, make SetPaused finalize segments, and add DB lifecycle tests.
This commit is contained in:
1 parent
41c967f7ad
commit
d8bda59d7d
4 files changed
+274
-24
No files matched your search
@@ -191,7 +191,7 @@ function fmtDuration(sec: number): string {
|
||||
// taskDuration counts only active execution segments. A live segment ticks locally;
|
||||
// paused, queued, and terminal tasks stay fixed at their persisted active total.
|
||||
function taskDuration(task: Task, nowSec: number): number {
|
||||
const active = Math.max(0, Math.floor(task.active_run_seconds ?? task.run_seconds ?? 0));
|
||||
const active = Math.max(0, Math.floor(task.active_run_seconds ?? 0));
|
||||
const segmentStart = task.run_segment_started_unix ?? 0;
|
||||
if (task.status === "running" && !task.paused && !task.queued && segmentStart > 0) {
|
||||
return active + Math.max(0, Math.floor(nowSec - segmentStart));
|
||||
|
||||
Reference in new issue
Block a user