From 296d07c6fe55120492aef9cfe8fe5aeb9065a11d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 19 May 2023 10:16:43 +0200 Subject: Prefer to wait before processing new jobs --- packages/peertube-runner/server/server.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/peertube-runner/server/server.ts b/packages/peertube-runner/server/server.ts index cb1533dc6..087405dfe 100644 --- a/packages/peertube-runner/server/server.ts +++ b/packages/peertube-runner/server/server.ts @@ -1,7 +1,7 @@ import { ensureDir, readdir, remove } from 'fs-extra' import { join } from 'path' import { io, Socket } from 'socket.io-client' -import { pick } from '@shared/core-utils' +import { pick, wait } from '@shared/core-utils' import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' import { PeerTubeServer as PeerTubeServerCommand } from '@shared/server-commands' import { ConfigManager } from '../shared' @@ -206,6 +206,8 @@ export class RunnerServer { this.checkingAvailableJobs = false if (hadAvailableJob && this.canProcessMoreJobs()) { + await wait(2500) + this.checkAvailableJobs() .catch(err => logger.error({ err }, 'Cannot check more available jobs')) } -- cgit v1.2.3