Reduce production hot-path logging

This commit is contained in:
Ben
2026-07-11 23:52:38 -04:00
parent 4f29269fed
commit bc6f2eebd8
6 changed files with 66 additions and 4 deletions
+11
View File
@@ -506,6 +506,10 @@ export class StratumV1Service implements OnModuleInit, OnModuleDestroy {
}
}
if (!this.shouldLogJobFanout(jobTemplate.blockData.isNewBlock, errors)) {
return;
}
console.log(JSON.stringify({
event: 'stratum_job_fanout',
eventId: jobTemplate.blockData.notificationEventId,
@@ -530,6 +534,13 @@ export class StratumV1Service implements OnModuleInit, OnModuleDestroy {
}));
}
private shouldLogJobFanout(isNewBlock: boolean, errors: number): boolean {
if (errors > 0 || isNewBlock) {
return true;
}
return process.env.STRATUM_FANOUT_LOG_ENABLED?.toLowerCase() === 'true';
}
private isBackpressureDisabled() {
return process.env.STRATUM_BACKPRESSURE_ENABLED?.toLowerCase() === 'false';
}