diff options
Diffstat (limited to 'server/lib/schedulers/video-channel-sync-latest-scheduler.ts')
-rw-r--r-- | server/lib/schedulers/video-channel-sync-latest-scheduler.ts | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/server/lib/schedulers/video-channel-sync-latest-scheduler.ts b/server/lib/schedulers/video-channel-sync-latest-scheduler.ts deleted file mode 100644 index efb957fac..000000000 --- a/server/lib/schedulers/video-channel-sync-latest-scheduler.ts +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | import { logger } from '@server/helpers/logger' | ||
2 | import { CONFIG } from '@server/initializers/config' | ||
3 | import { VideoChannelModel } from '@server/models/video/video-channel' | ||
4 | import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync' | ||
5 | import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants' | ||
6 | import { synchronizeChannel } from '../sync-channel' | ||
7 | import { AbstractScheduler } from './abstract-scheduler' | ||
8 | |||
9 | export class VideoChannelSyncLatestScheduler extends AbstractScheduler { | ||
10 | private static instance: AbstractScheduler | ||
11 | protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.CHANNEL_SYNC_CHECK_INTERVAL | ||
12 | |||
13 | private constructor () { | ||
14 | super() | ||
15 | } | ||
16 | |||
17 | protected async internalExecute () { | ||
18 | if (!CONFIG.IMPORT.VIDEO_CHANNEL_SYNCHRONIZATION.ENABLED) { | ||
19 | logger.debug('Discard channels synchronization as the feature is disabled') | ||
20 | return | ||
21 | } | ||
22 | |||
23 | logger.info('Checking channels to synchronize') | ||
24 | |||
25 | const channelSyncs = await VideoChannelSyncModel.listSyncs() | ||
26 | |||
27 | for (const sync of channelSyncs) { | ||
28 | const channel = await VideoChannelModel.loadAndPopulateAccount(sync.videoChannelId) | ||
29 | |||
30 | logger.info( | ||
31 | 'Creating video import jobs for "%s" sync with external channel "%s"', | ||
32 | channel.Actor.preferredUsername, sync.externalChannelUrl | ||
33 | ) | ||
34 | |||
35 | const onlyAfter = sync.lastSyncAt || sync.createdAt | ||
36 | |||
37 | await synchronizeChannel({ | ||
38 | channel, | ||
39 | externalChannelUrl: sync.externalChannelUrl, | ||
40 | videosCountLimit: CONFIG.IMPORT.VIDEO_CHANNEL_SYNCHRONIZATION.VIDEOS_LIMIT_PER_SYNCHRONIZATION, | ||
41 | channelSync: sync, | ||
42 | onlyAfter | ||
43 | }) | ||
44 | } | ||
45 | } | ||
46 | |||
47 | static get Instance () { | ||
48 | return this.instance || (this.instance = new this()) | ||
49 | } | ||
50 | } | ||