printstats
This commit is contained in:
parent
1d53f2d357
commit
d9a91c13ed
|
|
@ -23,6 +23,7 @@ export class UnifiedWorker {
|
||||||
private pollers: DomainPoller[] = [];
|
private pollers: DomainPoller[] = [];
|
||||||
private processor: MessageProcessor;
|
private processor: MessageProcessor;
|
||||||
private sqs: SQSHandler;
|
private sqs: SQSHandler;
|
||||||
|
private statusInterval: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private domains: string[],
|
private domains: string[],
|
||||||
|
|
@ -78,10 +79,16 @@ export class UnifiedWorker {
|
||||||
this.pollers.map((p) => p.stats.domain).join(', '),
|
this.pollers.map((p) => p.stats.domain).join(', '),
|
||||||
'SUCCESS',
|
'SUCCESS',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Starte den 5-Minuten-Status-Report
|
||||||
|
this.statusInterval = setInterval(() => {
|
||||||
|
this.printStatus();
|
||||||
|
}, 5 * 60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async stop(): Promise<void> {
|
async stop(): Promise<void> {
|
||||||
log('🛑 Stopping all domain pollers...');
|
log('🛑 Stopping all domain pollers...');
|
||||||
|
if (this.statusInterval) clearInterval(this.statusInterval); // <-- Neue Zeile
|
||||||
await Promise.all(this.pollers.map((p) => p.stop()));
|
await Promise.all(this.pollers.map((p) => p.stop()));
|
||||||
log('✅ All pollers stopped.');
|
log('✅ All pollers stopped.');
|
||||||
}
|
}
|
||||||
|
|
@ -103,4 +110,25 @@ export class UnifiedWorker {
|
||||||
|
|
||||||
return { totalProcessed, totalErrors, domains };
|
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