fix a few things about getRecentScritps

This commit is contained in:
Olivier Gagnon
2022-04-12 14:45:48 -04:00
parent a9b03f34ab
commit 52e01fc026
7 changed files with 16 additions and 30 deletions

View File

@@ -5,15 +5,11 @@ import { WorkerScript } from "./WorkerScript";
export const recentScripts: RecentScript[] = [];
export function AddRecentScript(workerScript: WorkerScript): void {
if (recentScripts.find((r) => r.pid === workerScript.pid)) return;
if (recentScripts.find((r) => r.runningScript.pid === workerScript.pid)) return;
const killedTime = new Date();
recentScripts.unshift({
filename: workerScript.name,
args: workerScript.args,
pid: workerScript.pid,
timestamp: killedTime,
timestampEpoch: killedTime.getTime(),
timeOfDeath: killedTime,
runningScript: workerScript.scriptRef,
});
@@ -23,10 +19,6 @@ export function AddRecentScript(workerScript: WorkerScript): void {
}
export interface RecentScript {
filename: string;
args: string[];
pid: number;
timestamp: Date;
timestampEpoch: number;
timeOfDeath: Date;
runningScript: RunningScript;
}