X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server.ts;h=f4f448e6b4732304b7c0f642067d3e8198f10171;hb=29aedac8dcfc98ff67680d91d6f0f848e86fa4db;hp=b8c1d12517e21666a1b00d314d6e20dbf34cade2;hpb=df1db951c512a58110171d046ef367789df02733;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server.ts b/server.ts index b8c1d1251..f4f448e6b 100644 --- a/server.ts +++ b/server.ts @@ -41,7 +41,12 @@ checkFFmpeg(CONFIG) process.exit(-1) }) -checkNodeVersion() +try { + checkNodeVersion() +} catch (err) { + logger.error('Error in NodeJS check.', { err }) + process.exit(-1) +} import { checkConfig, checkActivityPubUrls, checkFFmpegVersion } from './server/initializers/checker-after-init' @@ -117,6 +122,7 @@ import { VideosRedundancyScheduler } from './server/lib/schedulers/videos-redund import { RemoveOldHistoryScheduler } from './server/lib/schedulers/remove-old-history-scheduler' import { AutoFollowIndexInstances } from './server/lib/schedulers/auto-follow-index-instances' import { RemoveDanglingResumableUploadsScheduler } from './server/lib/schedulers/remove-dangling-resumable-uploads-scheduler' +import { VideoViewsBufferScheduler } from './server/lib/schedulers/video-views-buffer-scheduler' import { isHTTPSignatureDigestValid } from './server/helpers/peertube-crypto' import { PeerTubeSocket } from './server/lib/peertube-socket' import { updateStreamingPlaylistsInfohashesIfNeeded } from './server/lib/hls' @@ -128,12 +134,14 @@ import { LiveManager } from './server/lib/live' import { HttpStatusCode } from './shared/models/http/http-error-codes' import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache' import { ServerConfigManager } from '@server/lib/server-config-manager' +import { VideoViews } from '@server/lib/video-views' // ----------- Command line ----------- cli .option('--no-client', 'Start PeerTube without client interface') .option('--no-plugins', 'Start PeerTube without plugins/themes enabled') + .option('--benchmark-startup', 'Automatically stop server when initialized') .parse(process.argv) // ----------- App ----------- @@ -296,11 +304,11 @@ async function startApplication () { PeerTubeVersionCheckScheduler.Instance.enable() AutoFollowIndexInstances.Instance.enable() RemoveDanglingResumableUploadsScheduler.Instance.enable() + VideoViewsBufferScheduler.Instance.enable() - // Redis initialization Redis.Instance.init() - PeerTubeSocket.Instance.init(server) + VideoViews.Instance.init() updateStreamingPlaylistsInfohashesIfNeeded() .catch(err => logger.error('Cannot update streaming playlist infohashes.', { err })) @@ -322,6 +330,8 @@ async function startApplication () { logger.info('Web server: %s', WEBSERVER.URL) Hooks.runAction('action:application.listening') + + if (cliOptions['benchmarkStartup']) process.exit(0) }) process.on('exit', () => {