diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-19 10:16:43 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-19 10:16:43 +0200 |
commit | 296d07c6fe55120492aef9cfe8fe5aeb9065a11d (patch) | |
tree | 562648f4f94a6978c4a7b36b7854b94ce596955e /packages/peertube-runner/server | |
parent | 472170b4f923a52cceb595221864eab61d624d5b (diff) | |
download | PeerTube-296d07c6fe55120492aef9cfe8fe5aeb9065a11d.tar.gz PeerTube-296d07c6fe55120492aef9cfe8fe5aeb9065a11d.tar.zst PeerTube-296d07c6fe55120492aef9cfe8fe5aeb9065a11d.zip |
Prefer to wait before processing new jobs
Diffstat (limited to 'packages/peertube-runner/server')
-rw-r--r-- | packages/peertube-runner/server/server.ts | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ | |||
1 | import { ensureDir, readdir, remove } from 'fs-extra' | 1 | import { ensureDir, readdir, remove } from 'fs-extra' |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { io, Socket } from 'socket.io-client' | 3 | import { io, Socket } from 'socket.io-client' |
4 | import { pick } from '@shared/core-utils' | 4 | import { pick, wait } from '@shared/core-utils' |
5 | import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' | 5 | import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' |
6 | import { PeerTubeServer as PeerTubeServerCommand } from '@shared/server-commands' | 6 | import { PeerTubeServer as PeerTubeServerCommand } from '@shared/server-commands' |
7 | import { ConfigManager } from '../shared' | 7 | import { ConfigManager } from '../shared' |
@@ -206,6 +206,8 @@ export class RunnerServer { | |||
206 | this.checkingAvailableJobs = false | 206 | this.checkingAvailableJobs = false |
207 | 207 | ||
208 | if (hadAvailableJob && this.canProcessMoreJobs()) { | 208 | if (hadAvailableJob && this.canProcessMoreJobs()) { |
209 | await wait(2500) | ||
210 | |||
209 | this.checkAvailableJobs() | 211 | this.checkAvailableJobs() |
210 | .catch(err => logger.error({ err }, 'Cannot check more available jobs')) | 212 | .catch(err => logger.error({ err }, 'Cannot check more available jobs')) |
211 | } | 213 | } |