mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
Limit background services by process role
This commit is contained in:
@@ -14,6 +14,10 @@ export class NotificationService implements OnModuleInit {
|
|||||||
) { }
|
) { }
|
||||||
|
|
||||||
async onModuleInit(): Promise<void> {
|
async onModuleInit(): Promise<void> {
|
||||||
|
if (process.env.MASTER !== 'true') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await this.discordService.notifyRestarted();
|
await this.discordService.notifyRestarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,8 +154,10 @@ export class StratumV1JobsService {
|
|||||||
shareReplay({ refCount: true, bufferSize: 1 })
|
shareReplay({ refCount: true, bufferSize: 1 })
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (process.env.API_ONLY !== 'true') {
|
||||||
this.newMiningJob$.subscribe();
|
this.newMiningJob$.subscribe();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private calculateNetworkDifficulty(nBits: number) {
|
private calculateNetworkDifficulty(nBits: number) {
|
||||||
const mantissa: number = nBits & 0x007fffff; // Extract the mantissa from nBits
|
const mantissa: number = nBits & 0x007fffff; // Extract the mantissa from nBits
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ export class TelegramService implements OnModuleInit {
|
|||||||
private readonly configService: ConfigService,
|
private readonly configService: ConfigService,
|
||||||
private readonly telegramSubscriptionsService: TelegramSubscriptionsService
|
private readonly telegramSubscriptionsService: TelegramSubscriptionsService
|
||||||
) {
|
) {
|
||||||
|
if (process.env.MASTER !== 'true') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const token: string | null = this.configService.get('TELEGRAM_BOT_TOKEN');
|
const token: string | null = this.configService.get('TELEGRAM_BOT_TOKEN');
|
||||||
if (token == null || token.length < 1) {
|
if (token == null || token.length < 1) {
|
||||||
return;
|
return;
|
||||||
@@ -32,6 +36,9 @@ export class TelegramService implements OnModuleInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async onModuleInit(): Promise<void> {
|
async onModuleInit(): Promise<void> {
|
||||||
|
if (process.env.MASTER !== 'true') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.bot == null) {
|
if (this.bot == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user