Browse Source

refactor: Add data module unique job name check

Co-authored-by: Kristian Vos <k.vos@kvos.dev>
Owen Diffey 1 month ago
parent
commit
a83db81716
1 changed files with 5 additions and 1 deletions
  1. 5 1
      backend/src/modules/DataModule.ts

+ 5 - 1
backend/src/modules/DataModule.ts

@@ -317,7 +317,11 @@ export class DataModule extends BaseModule {
 				`${jobFile.path}/${jobFile.name}`
 			);
 
-			this._jobs[JobClass.getName()] = JobClass;
+			const jobName = JobClass.getName();
+			if (this._jobs[jobName]) {
+				throw new Error(`Two jobs with the same name: ${jobName}`);
+			}
+			this._jobs[jobName] = JobClass;
 		});
 	}