From 709756b8e183f67ef9bf8f7bc149af4736260350 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 7 Jul 2017 16:57:28 +0200 Subject: Async signature and various fixes --- server/controllers/api/remote/videos.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/remote/videos.ts b/server/controllers/api/remote/videos.ts index ebe4eca36..eb033637e 100644 --- a/server/controllers/api/remote/videos.ts +++ b/server/controllers/api/remote/videos.ts @@ -64,8 +64,7 @@ function remoteVideos (req: express.Request, res: express.Response, next: expres const fromPod = res.locals.secure.pod // We need to process in the same order to keep consistency - // TODO: optimization - Promise.mapSeries(requests, (request: any) => { + Promise.each(requests, (request: any) => { const data = request.data // Get the function we need to call in order to process the request @@ -79,7 +78,7 @@ function remoteVideos (req: express.Request, res: express.Response, next: expres }) .catch(err => logger.error('Error managing remote videos.', { error: err })) - // We don't need to keep the other pod waiting + // Don't block the other pod return res.type('json').status(204).end() } @@ -87,7 +86,7 @@ function remoteVideosQadu (req: express.Request, res: express.Response, next: ex const requests = req.body.data const fromPod = res.locals.secure.pod - Promise.mapSeries(requests, (request: any) => { + Promise.each(requests, (request: any) => { const videoData = request.data return quickAndDirtyUpdateVideoRetryWrapper(videoData, fromPod) @@ -101,7 +100,7 @@ function remoteVideosEvents (req: express.Request, res: express.Response, next: const requests = req.body.data const fromPod = res.locals.secure.pod - Promise.mapSeries(requests, (request: any) => { + Promise.each(requests, (request: any) => { const eventData = request.data return processVideosEventsRetryWrapper(eventData, fromPod) -- cgit v1.2.3