From: Chocobozzz Date: Mon, 10 May 2021 08:52:52 +0000 (+0200) Subject: Optimize videos feed endpoint X-Git-Tag: v3.2.0-rc.1~23 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=649e812947b1afa1f025f2f3dc833a8cfb772e9c;p=github%2FChocobozzz%2FPeerTube.git Optimize videos feed endpoint --- diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index 921067e65..f0717bbbc 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts @@ -167,7 +167,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) { videoChannelId: videoChannel ? videoChannel.id : null } - const resultList = await VideoModel.listForApi({ + const { data } = await VideoModel.listForApi({ start, count: FEEDS.COUNT, sort: req.query.sort, @@ -175,10 +175,11 @@ async function generateVideoFeed (req: express.Request, res: express.Response) { nsfw, filter: req.query.filter as VideoFilter, withFiles: true, + countVideos: false, ...options }) - addVideosToFeed(feed, resultList.data) + addVideosToFeed(feed, data) // Now the feed generation is done, let's send it! return sendFeed(feed, req, res) @@ -198,20 +199,22 @@ async function generateVideoFeedForSubscriptions (req: express.Request, res: exp queryString: new URL(WEBSERVER.URL + req.url).search }) - const resultList = await VideoModel.listForApi({ + const { data } = await VideoModel.listForApi({ start, count: FEEDS.COUNT, sort: req.query.sort, includeLocalVideos: false, nsfw, filter: req.query.filter as VideoFilter, + withFiles: true, + countVideos: false, followerActorId: res.locals.user.Account.Actor.id, user: res.locals.user }) - addVideosToFeed(feed, resultList.data) + addVideosToFeed(feed, data) // Now the feed generation is done, let's send it! return sendFeed(feed, req, res)