printstats
This commit is contained in:
parent
12af8577f3
commit
757855866c
|
|
@ -23,6 +23,7 @@ export class UnifiedWorker {
|
|||
private pollers: DomainPoller[] = [];
|
||||
private processor: MessageProcessor;
|
||||
private sqs: SQSHandler;
|
||||
private statusInterval: NodeJS.Timeout | null = null;
|
||||
|
||||
constructor(
|
||||
private domains: string[],
|
||||
|
|
@ -78,10 +79,16 @@ export class UnifiedWorker {
|
|||
this.pollers.map((p) => p.stats.domain).join(', '),
|
||||
'SUCCESS',
|
||||
);
|
||||
|
||||
// Starte den 5-Minuten-Status-Report
|
||||
this.statusInterval = setInterval(() => {
|
||||
this.printStatus();
|
||||
}, 5 * 60 * 1000);
|
||||
}
|
||||
|
||||
async stop(): Promise<void> {
|
||||
log('🛑 Stopping all domain pollers...');
|
||||
if (this.statusInterval) clearInterval(this.statusInterval); // <-- Neue Zeile
|
||||
await Promise.all(this.pollers.map((p) => p.stop()));
|
||||
log('✅ All pollers stopped.');
|
||||
}
|
||||
|
|
@ -103,4 +110,25 @@ export class UnifiedWorker {
|
|||
|
||||
return { totalProcessed, totalErrors, domains };
|
||||
}
|
||||
|
||||
private printStatus(): void {
|
||||
const stats = this.getStats();
|
||||
// Zähle aktive Poller
|
||||
const activePollers = this.pollers.filter((p) => p.stats.running).length;
|
||||
const totalPollers = this.pollers.length;
|
||||
|
||||
// Formatiere die Domain-Statistiken (z.B. hotshpotshga:1)
|
||||
const domainStats = stats.domains
|
||||
.map((d) => {
|
||||
const shortName = d.domain.split('.')[0].substring(0, 12);
|
||||
return `${shortName}:${d.processed}`;
|
||||
})
|
||||
.join(' | ');
|
||||
|
||||
log(
|
||||
`📊 Status: ${activePollers}/${totalPollers} active, total:${stats.totalProcessed} | ${domainStats}`,
|
||||
'INFO',
|
||||
'unified-worker'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue