瀏覽代碼

More bug fixes

Kristian Vos 4 年之前
父節點
當前提交
c0980522b8
共有 2 個文件被更改,包括 31 次插入0 次删除
  1. 30 0
      backend/index.js
  2. 1 0
      backend/logic/io.js

+ 30 - 0
backend/index.js

@@ -456,6 +456,36 @@ process.stdin.on("data", data => {
 
 		console.log(moduleManager.modules[parts[1]].jobStatistics);
 	}
+	if (command.startsWith("jobinfo")) {
+		const parts = command.split(" ");
+
+		const uuid = parts[1];
+		let jobFound = null;
+
+		Object.keys(moduleManager.modules).forEach(moduleName => {
+			const module = moduleManager.modules[moduleName];
+			const task1 = module.jobQueue.runningTasks.find(task => task.job.uniqueId === uuid);
+			const task2 = module.jobQueue.queue.find(task => task.job.uniqueId === uuid);
+			const task3 = module.jobQueue.pausedTasks.find(task => task.job.uniqueId === uuid);
+			if (task1) jobFound = task1.job;
+			if (task2) jobFound = task2.job;
+			if (task3) jobFound = task3.job;
+		});
+
+		if (jobFound) {
+			let topParent = jobFound;
+			let levelsDeep = 0;
+			while (topParent.parentJob && topParent !== topParent.parentJob) {
+				topParent = jobFound.parentJob;
+				levelsDeep += 1;
+			}
+			console.log(
+				`Found job, displaying that job and the full tree from the top parent job. The job is ${levelsDeep} levels deep from the top parent.`
+			);
+			console.log(jobFound);
+			printJob(topParent, 1);
+		} else console.log("Could not find job in any running, queued or paused lists in any module.");
+	}
 	// if (command.startsWith("debug")) {
 	// }
 

+ 1 - 0
backend/logic/io.js

@@ -736,6 +736,7 @@ class _IOModule extends CoreClass {
 					IOModule.runJob("RUN_ACTION2", { session: socket.session, namespace, action, args })
 						.then(response => {
 							cb(response);
+							resolve();
 						})
 						.catch(err => {
 							if (typeof cb === "function")