refactor(core): Move instanceType to InstanceSettings (no-changelog) (#10640)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-09-16 13:37:14 +02:00
committed by GitHub
parent 50beefb658
commit 25c8a328a8
25 changed files with 85 additions and 89 deletions

View File

@@ -31,8 +31,6 @@ import type {
export class ScalingService {
private queue: JobQueue;
private readonly instanceType = config.getEnv('generic.instanceType');
constructor(
private readonly logger: Logger,
private readonly activeExecutions: ActiveExecutions,
@@ -211,9 +209,10 @@ export class ScalingService {
throw error;
});
if (this.instanceType === 'main' || this.instanceType === 'webhook') {
const { instanceType } = this.instanceSettings;
if (instanceType === 'main' || instanceType === 'webhook') {
this.registerMainOrWebhookListeners();
} else if (this.instanceType === 'worker') {
} else if (instanceType === 'worker') {
this.registerWorkerListeners();
}
}
@@ -295,7 +294,7 @@ export class ScalingService {
}
private assertWorker() {
if (this.instanceType === 'worker') return;
if (this.instanceSettings.instanceType === 'worker') return;
throw new ApplicationError('This method must be called on a `worker` instance');
}
@@ -311,7 +310,7 @@ export class ScalingService {
get isQueueMetricsEnabled() {
return (
this.globalConfig.endpoints.metrics.includeQueueMetrics &&
this.instanceType === 'main' &&
this.instanceSettings.instanceType === 'main' &&
!this.orchestrationService.isMultiMainSetupEnabled
);
}