diff --git a/apps/peertube-runner/src/server/server.ts b/apps/peertube-runner/src/server/server.ts index 948356eec..410015a91 100644 --- a/apps/peertube-runner/src/server/server.ts +++ b/apps/peertube-runner/src/server/server.ts @@ -26,18 +26,20 @@ export class RunnerServer { private cleaningUp = false private initialized = false + private readonly enabledJobsArray: RunnerJobType[] + private readonly sockets = new Map() - constructor (private readonly enabledJobs?: Set) {} + constructor (private readonly enabledJobs?: Set) { + this.enabledJobsArray = enabledJobs + ? Array.from(enabledJobs) + : getSupportedJobsList() + } async run () { logger.info('Running PeerTube runner in server mode') - const enabledJobsArray = this.enabledJobs - ? Array.from(this.enabledJobs) - : getSupportedJobsList() - - logger.info('Supported and enabled job types: ' + enabledJobsArray.join(', ')) + logger.info('Supported and enabled job types: ' + this.enabledJobsArray.join(', ')) await ConfigManager.Instance.load() @@ -240,8 +242,8 @@ export class RunnerServer { const { availableJobs } = await server.runnerJobs.request({ runnerToken: server.runnerToken, - jobTypes: this.enabledJobs.size !== getSupportedJobsList().length - ? Array.from(this.enabledJobs) + jobTypes: this.enabledJobsArray.length !== getSupportedJobsList().length + ? this.enabledJobsArray : undefined }) diff --git a/apps/peertube-runner/src/server/shared/supported-job.ts b/apps/peertube-runner/src/server/shared/supported-job.ts index 3e14261a6..6be753cd7 100644 --- a/apps/peertube-runner/src/server/shared/supported-job.ts +++ b/apps/peertube-runner/src/server/shared/supported-job.ts @@ -46,5 +46,5 @@ export function isJobSupported (job: { type: RunnerJobType, payload: RunnerJobPa } export function getSupportedJobsList () { - return Object.keys(supportedMatrix) + return Object.keys(supportedMatrix) as unknown as RunnerJobType[] }