diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-20 10:13:13 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-20 11:45:59 +0200 |
commit | 91411dba928678c15a5e99d9795ae061909e397d (patch) | |
tree | 7ba6e340cc9eb6f993051fcac74eefd652cb0ffd /server/lib | |
parent | fcc7c060374c3a547257d96af847352c14d6144b (diff) | |
download | PeerTube-91411dba928678c15a5e99d9795ae061909e397d.tar.gz PeerTube-91411dba928678c15a5e99d9795ae061909e397d.tar.zst PeerTube-91411dba928678c15a5e99d9795ae061909e397d.zip |
Limit associations fetch when loading token
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/videos.ts | 4 | ||||
-rw-r--r-- | server/lib/schedulers/youtube-dl-update-scheduler.ts | 7 |
2 files changed, 2 insertions, 9 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 91231a187..48c0e0a5c 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -354,11 +354,11 @@ async function refreshVideoIfNeeded (options: { | |||
354 | syncParam: SyncParam, | 354 | syncParam: SyncParam, |
355 | refreshViews: boolean | 355 | refreshViews: boolean |
356 | }): Promise<VideoModel> { | 356 | }): Promise<VideoModel> { |
357 | if (!options.video.isOutdated()) return options.video | ||
358 | |||
357 | // We need more attributes if the argument video was fetched with not enough joints | 359 | // We need more attributes if the argument video was fetched with not enough joints |
358 | const video = options.fetchedType === 'all' ? options.video : await VideoModel.loadByUrlAndPopulateAccount(options.video.url) | 360 | const video = options.fetchedType === 'all' ? options.video : await VideoModel.loadByUrlAndPopulateAccount(options.video.url) |
359 | 361 | ||
360 | if (!video.isOutdated()) return video | ||
361 | |||
362 | try { | 362 | try { |
363 | const { response, videoObject } = await fetchRemoteVideo(video.url) | 363 | const { response, videoObject } = await fetchRemoteVideo(video.url) |
364 | if (response.statusCode === 404) { | 364 | if (response.statusCode === 404) { |
diff --git a/server/lib/schedulers/youtube-dl-update-scheduler.ts b/server/lib/schedulers/youtube-dl-update-scheduler.ts index 2fc8950fe..461cd045e 100644 --- a/server/lib/schedulers/youtube-dl-update-scheduler.ts +++ b/server/lib/schedulers/youtube-dl-update-scheduler.ts | |||
@@ -1,12 +1,5 @@ | |||
1 | |||
2 | |||
3 | import { AbstractScheduler } from './abstract-scheduler' | 1 | import { AbstractScheduler } from './abstract-scheduler' |
4 | import { SCHEDULER_INTERVALS_MS } from '../../initializers' | 2 | import { SCHEDULER_INTERVALS_MS } from '../../initializers' |
5 | import { logger } from '../../helpers/logger' | ||
6 | import * as request from 'request' | ||
7 | import { createWriteStream, ensureDir, writeFile } from 'fs-extra' | ||
8 | import { join } from 'path' | ||
9 | import { root } from '../../helpers/core-utils' | ||
10 | import { updateYoutubeDLBinary } from '../../helpers/youtube-dl' | 3 | import { updateYoutubeDLBinary } from '../../helpers/youtube-dl' |
11 | 4 | ||
12 | export class YoutubeDlUpdateScheduler extends AbstractScheduler { | 5 | export class YoutubeDlUpdateScheduler extends AbstractScheduler { |