fix: Duplicate plugin registration logging in debug

This commit is contained in:
Tom Moor
2024-05-03 08:15:56 -04:00
parent adc4f2b544
commit 9204a8ab30
2 changed files with 11 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ async function master() {
}
// This function will only be called in each forked process
async function start(id: number, disconnect: () => void) {
async function start(_id: number, disconnect: () => void) {
// Ensure plugins are loaded
PluginManager.loadPlugins();

View File

@@ -81,6 +81,9 @@ export class PluginManager {
.get(plugin.type)!
.push({ ...plugin, priority: plugin.priority ?? PluginPriority.Normal });
// Do not log plugin registration in forked worker processes, one log from the master process
// is enough. This can be detected by the presence of `process.send`.
if (process.send === undefined) {
Logger.debug(
"plugins",
`Plugin(type=${plugin.type}) registered ${
@@ -88,6 +91,7 @@ export class PluginManager {
} ${plugin.description ? `(${plugin.description})` : ""}`
);
}
}
/**
* Returns all the plugins of a given type in order of priority.