diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index 467303e..fcc988e 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -20,10 +20,10 @@ var ErrRepoInitializationFailed = errors.New("repo initialization failed") var ErrPlanNotFound = errors.New("plan not found") const ( - TaskPriorityDefault = iota - TaskPriorityInteractive // higher priority than default scheduled operations e.g. the user clicked to run an operation. - taskPriorityForget + TaskPriorityDefault = iota + TaskPriorityInteractive // higher priority than default scheduled operations e.g. the user clicked to run an operation taskPriorityIndexSnapshots // higher priority than interactive operations e.g. a system operation like a forget or index (typically scheduled by another task that wants work done immediately after it's completion). + taskPriorityForget ) // Orchestrator is responsible for managing repos and backups. @@ -163,8 +163,9 @@ func (o *Orchestrator) ScheduleTask(t Task, priority int) { } zap.L().Info("scheduling task", zap.String("task", t.Name()), zap.String("runAt", nextRun.Format(time.RFC3339))) o.taskQueue.Push(scheduledTask{ - task: t, - runAt: *nextRun, + task: t, + runAt: *nextRun, + priority: priority, }) } diff --git a/webui/src/components/OperationList.tsx b/webui/src/components/OperationList.tsx index 656b64b..7943c42 100644 --- a/webui/src/components/OperationList.tsx +++ b/webui/src/components/OperationList.tsx @@ -147,7 +147,7 @@ export const OperationRow = ({ parseInt(operation.unixTimeStartMs!) )}`; } else if (operation.status === OperationStatus.STATUS_INPROGRESS) { - desc += " and is still running."; + desc += " is still running."; } return ( diff --git a/webui/src/lib/formatting.ts b/webui/src/lib/formatting.ts index 7510b50..d285e30 100644 --- a/webui/src/lib/formatting.ts +++ b/webui/src/lib/formatting.ts @@ -48,7 +48,7 @@ export const formatDate = (time: number | string | Date) => { }; export const formatDuration = (ms: number) => { - const seconds = Math.floor(ms / 100) / 10; + const seconds = Math.ceil(ms / 100); const minutes = Math.floor(seconds / 60); const hours = Math.floor(minutes / 60); if (hours === 0 && minutes === 0) { @@ -56,7 +56,7 @@ export const formatDuration = (ms: number) => { } else if (hours === 0) { return `${minutes}m${seconds % 60}s`; } - return `${hours}h${minutes % 60}m${seconds % 60}s`; + return `${hours}h${minutes % 60}m${Math.floor(seconds)}s`; }; export const normalizeSnapshotId = (id: string) => {