Dr-Swopt 1 неделя назад
Родитель
Сommit
34d62bcb04
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      src/surveillance/surveillance.service.ts

+ 4 - 1
src/surveillance/surveillance.service.ts

@@ -28,10 +28,13 @@ const normalizeCommand = (cmd: string | null | undefined): string => {
   return cmd.toLowerCase().replace(/\\/g, '/').trim();
 };
 
+// n8n is only monitorable when running locally — skip process tracking if the webhook points elsewhere
+const N8N_IS_LOCAL = (process.env['N8N_WEBHOOK_URL'] ?? '').toLowerCase().includes('localhost');
+
 // Matcher functions — nestjs uses PID identity; others use .some() over signature arrays for resilience
 const SERVICE_MATCHERS: Record<string, (p: si.Systeminformation.ProcessesProcessData) => boolean> = {
   nestjs: (p) => p.pid === process.pid,
-  n8n:    (p) => { const cmd = normalizeCommand(p.command); return ['n8n', 'n8n.exe', 'n8n-desktop'].some(sig => cmd.includes(sig)); },
+  n8n:    (p) => { if (!N8N_IS_LOCAL) return false; const cmd = normalizeCommand(p.command); return ['n8n', 'n8n.exe', 'n8n-desktop'].some(sig => cmd.includes(sig)); },
   ollama: (p) => { const cmd = normalizeCommand(p.command); return ['ollama', 'ollama_llama_server'].some(sig => cmd.includes(sig)); },
 };