Bumped to version v0.0.20-alpha
[oweals/peertube.git] / server.ts
index a138b63592a8b772516e92226570a1525aed71da..44e93d1a6102324d97703cc9462b89b434305de2 100644 (file)
--- a/server.ts
+++ b/server.ts
@@ -53,10 +53,13 @@ migrate()
 
 // ----------- PeerTube modules -----------
 import { installApplication } from './server/initializers'
-import { activitypubHttpJobScheduler, transcodingJobScheduler } from './server/lib/jobs'
+import { Emailer } from './server/lib/emailer'
+import { JobQueue } from './server/lib/job-queue'
 import { VideosPreviewCache } from './server/lib/cache'
 import { apiRouter, clientsRouter, staticRouter, servicesRouter, webfingerRouter, activityPubRouter } from './server/controllers'
+import { Redis } from './server/lib/redis'
 import { BadActorFollowScheduler } from './server/lib/schedulers/bad-actor-follow-scheduler'
+import { RemoveOldJobsScheduler } from './server/lib/schedulers/remove-old-jobs-scheduler'
 
 // ----------- Command line -----------
 
@@ -168,11 +171,20 @@ function onDatabaseInitDone () {
     .then(() => {
       // ----------- Make the server listening -----------
       server.listen(port, () => {
+        // Emailer initialization and then job queue initialization
+        Emailer.Instance.init()
+        Emailer.Instance.checkConnectionOrDie()
+          .then(() => JobQueue.Instance.init())
+
+        // Caches initializations
         VideosPreviewCache.Instance.init(CONFIG.CACHE.PREVIEWS.SIZE)
+
+        // Enable Schedulers
         BadActorFollowScheduler.Instance.enable()
+        RemoveOldJobsScheduler.Instance.enable()
 
-        activitypubHttpJobScheduler.activate()
-        transcodingJobScheduler.activate()
+        // Redis initialization
+        Redis.Instance.init()
 
         logger.info('Server listening on port %d', port)
         logger.info('Web server: %s', CONFIG.WEBSERVER.URL)