]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/server/redundancy.ts
Add missing dependency to Debian / Ubuntu section
[github/Chocobozzz/PeerTube.git] / server / controllers / api / server / redundancy.ts
index a11c1a74fc58ed22652c0e8ea0806725d042b3ee..7c13dc21b67df58abb972beef8d0e08325cf4359 100644 (file)
@@ -19,6 +19,7 @@ import { removeRedundanciesOfServer, removeVideoRedundancy } from '../../../lib/
 import { logger } from '../../../helpers/logger'
 import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'
 import { JobQueue } from '@server/lib/job-queue'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 const serverRedundancyRouter = express.Router()
 
@@ -84,18 +85,18 @@ async function addVideoRedundancy (req: express.Request, res: express.Response)
     videoId: res.locals.onlyVideo.id
   }
 
-  await JobQueue.Instance.createJob({
+  await JobQueue.Instance.createJobWithPromise({
     type: 'video-redundancy',
     payload
   })
 
-  return res.sendStatus(204)
+  return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
 }
 
 async function removeVideoRedundancyController (req: express.Request, res: express.Response) {
   await removeVideoRedundancy(res.locals.videoRedundancy)
 
-  return res.sendStatus(204)
+  return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
 }
 
 async function updateRedundancy (req: express.Request, res: express.Response) {
@@ -109,5 +110,5 @@ async function updateRedundancy (req: express.Request, res: express.Response) {
   removeRedundanciesOfServer(server.id)
     .catch(err => logger.error('Cannot remove redundancy of %s.', server.host, { err }))
 
-  return res.sendStatus(204)
+  return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
 }