X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fserver%2Fserver.ts;h=66b7ff09d2702733423583fcdcbdca6cbf716612;hb=6292fb984348935692711ddc9a9630e29c3f0148;hp=793fae3a85b900ad8d5e4b59791ac04a022b9d4c;hpb=3a380e9a71037b0fcbace58a7599221e7cc76e20;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/server/server.ts b/shared/server-commands/server/server.ts index 793fae3a8..66b7ff09d 100644 --- a/shared/server-commands/server/server.ts +++ b/shared/server-commands/server/server.ts @@ -8,9 +8,9 @@ import { CLICommand } from '../cli' import { CustomPagesCommand } from '../custom-pages' import { FeedCommand } from '../feeds' import { LogsCommand } from '../logs' -import { SQLCommand } from '../miscs' import { AbusesCommand } from '../moderation' import { OverviewsCommand } from '../overviews' +import { RunnerJobsCommand, RunnerRegistrationTokensCommand, RunnersCommand } from '../runners' import { SearchCommand } from '../search' import { SocketIOCommand } from '../socket' import { @@ -136,7 +136,6 @@ export class PeerTubeServer { streamingPlaylists?: StreamingPlaylistsCommand channels?: ChannelsCommand comments?: CommentsCommand - sql?: SQLCommand notifications?: NotificationsCommand servers?: ServersCommand login?: LoginCommand @@ -150,6 +149,10 @@ export class PeerTubeServer { videoToken?: VideoTokenCommand registrations?: RegistrationsCommand + runners?: RunnersCommand + runnerRegistrationTokens?: RunnerRegistrationTokensCommand + runnerJobs?: RunnerJobsCommand + constructor (options: { serverNumber: number } | { url: string }) { if ((options as any).url) { this.setUrl((options as any).url) @@ -201,7 +204,7 @@ export class PeerTubeServer { return join(root(), testDirectory, directoryName) } - async flushAndRun (configOverride?: Object, options: RunServerOptions = {}) { + async flushAndRun (configOverride?: object, options: RunServerOptions = {}) { await ServersCommand.flushTests(this.internalServerNumber) return this.run(configOverride, options) @@ -247,7 +250,7 @@ export class PeerTubeServer { const forkOptions = { silent: true, env, - detached: true, + detached: false, execArgv } @@ -311,18 +314,18 @@ export class PeerTubeServer { }) } - async kill () { - if (!this.app) return - - await this.sql.cleanup() + kill () { + if (!this.app) return Promise.resolve() - process.kill(-this.app.pid) + process.kill(this.app.pid) this.app = null + + return Promise.resolve() } private randomServer () { - const low = 10 + const low = 2500 const high = 10000 return randomInt(low, high) @@ -361,6 +364,7 @@ export class PeerTubeServer { }, storage: { tmp: this.getDirectoryPath('tmp') + '/', + tmp_persistent: this.getDirectoryPath('tmp-persistent') + '/', bin: this.getDirectoryPath('bin') + '/', avatars: this.getDirectoryPath('avatars') + '/', videos: this.getDirectoryPath('videos') + '/', @@ -420,7 +424,6 @@ export class PeerTubeServer { this.streamingPlaylists = new StreamingPlaylistsCommand(this) this.channels = new ChannelsCommand(this) this.comments = new CommentsCommand(this) - this.sql = new SQLCommand(this) this.notifications = new NotificationsCommand(this) this.servers = new ServersCommand(this) this.login = new LoginCommand(this) @@ -433,5 +436,9 @@ export class PeerTubeServer { this.twoFactor = new TwoFactorCommand(this) this.videoToken = new VideoTokenCommand(this) this.registrations = new RegistrationsCommand(this) + + this.runners = new RunnersCommand(this) + this.runnerRegistrationTokens = new RunnerRegistrationTokensCommand(this) + this.runnerJobs = new RunnerJobsCommand(this) } }