From: Chocobozzz Date: Fri, 27 Jul 2018 10:01:31 +0000 (+0200) Subject: Revert SQL optimization in videos list :( X-Git-Tag: v1.0.0-beta.10.pre.2~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=18dbb5b9723040e19fea1ed6b0c4f2738508ffc8;p=oweals%2Fpeertube.git Revert SQL optimization in videos list :( --- diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 3a3cfbe85..33d62926b 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -215,8 +215,8 @@ type AvailableForListOptions = { 'INNER JOIN "videoChannel" ON "videoChannel"."id" = "video"."channelId" ' + 'INNER JOIN "account" ON "account"."id" = "videoChannel"."accountId" ' + 'INNER JOIN "actor" ON "account"."actorId" = "actor"."id" ' + - 'WHERE "actor"."serverId" IS NULL OR ' + - '"actor"."id" IN (SELECT "targetActorId" FROM "actorFollow" WHERE "actorId" = 1)' + // Subquery for optimization + 'LEFT JOIN "actorFollow" ON "actorFollow"."targetActorId" = "actor"."id" ' + + 'WHERE "actor"."serverId" IS NULL OR "actorFollow"."actorId" = ' + actorIdNumber + ')' ) }, @@ -632,7 +632,7 @@ export class VideoModel extends Model { // Do not wait video deletion because we could be in a transaction Promise.all(tasks) .catch(err => { - logger.error('Some errors when removing files of video %s in after destroy hook.', instance.uuid, { err }) + logger.error('Some errors when removing files of video %s in before destroy hook.', instance.uuid, { err }) }) return undefined