From 41fb13c330de629df2d23379209e79c7af0f2e9a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 27 Aug 2021 14:32:44 +0200 Subject: esModuleInterop to true --- server/lib/job-queue/handlers/activitypub-cleaner.ts | 12 ++++++------ server/lib/job-queue/handlers/activitypub-follow.ts | 4 ++-- .../lib/job-queue/handlers/activitypub-http-broadcast.ts | 8 ++++---- server/lib/job-queue/handlers/activitypub-http-fetcher.ts | 4 ++-- server/lib/job-queue/handlers/activitypub-http-unicast.ts | 4 ++-- server/lib/job-queue/handlers/activitypub-refresher.ts | 4 ++-- server/lib/job-queue/handlers/actor-keys.ts | 4 ++-- server/lib/job-queue/handlers/email.ts | 6 +++--- server/lib/job-queue/handlers/move-to-object-storage.ts | 4 ++-- server/lib/job-queue/handlers/video-file-import.ts | 4 ++-- server/lib/job-queue/handlers/video-import.ts | 8 ++++---- server/lib/job-queue/handlers/video-live-ending.ts | 4 ++-- server/lib/job-queue/handlers/video-redundancy.ts | 6 +++--- server/lib/job-queue/handlers/video-transcoding.ts | 14 +++++++------- 14 files changed, 43 insertions(+), 43 deletions(-) (limited to 'server/lib/job-queue/handlers') diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts index 56e2b0ceb..d5e4508fe 100644 --- a/server/lib/job-queue/handlers/activitypub-cleaner.ts +++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts @@ -1,5 +1,5 @@ -import * as Bluebird from 'bluebird' -import * as Bull from 'bull' +import { map } from 'bluebird' +import { Job } from 'bull' import { checkUrlsSameHost } from '@server/helpers/activitypub' import { isAnnounceActivityValid, @@ -18,14 +18,14 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat // Job to clean remote interactions off local videos -async function processActivityPubCleaner (_job: Bull.Job) { +async function processActivityPubCleaner (_job: Job) { logger.info('Processing ActivityPub cleaner.') { const rateUrls = await AccountVideoRateModel.listRemoteRateUrlsOfLocalVideos() const { bodyValidator, deleter, updater } = rateOptionsFactory() - await Bluebird.map(rateUrls, async rateUrl => { + await map(rateUrls, async rateUrl => { try { const result = await updateObjectIfNeeded(rateUrl, bodyValidator, updater, deleter) @@ -44,7 +44,7 @@ async function processActivityPubCleaner (_job: Bull.Job) { const shareUrls = await VideoShareModel.listRemoteShareUrlsOfLocalVideos() const { bodyValidator, deleter, updater } = shareOptionsFactory() - await Bluebird.map(shareUrls, async shareUrl => { + await map(shareUrls, async shareUrl => { try { await updateObjectIfNeeded(shareUrl, bodyValidator, updater, deleter) } catch (err) { @@ -57,7 +57,7 @@ async function processActivityPubCleaner (_job: Bull.Job) { const commentUrls = await VideoCommentModel.listRemoteCommentUrlsOfLocalVideos() const { bodyValidator, deleter, updater } = commentOptionsFactory() - await Bluebird.map(commentUrls, async commentUrl => { + await map(commentUrls, async commentUrl => { try { await updateObjectIfNeeded(commentUrl, bodyValidator, updater, deleter) } catch (err) { diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts index f896d7af4..91e3d33c6 100644 --- a/server/lib/job-queue/handlers/activitypub-follow.ts +++ b/server/lib/job-queue/handlers/activitypub-follow.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { getLocalActorFollowActivityPubUrl } from '@server/lib/activitypub/url' import { ActivitypubFollowPayload } from '@shared/models' import { sanitizeHost } from '../../../helpers/core-utils' @@ -13,7 +13,7 @@ import { getOrCreateAPActor, loadActorUrlOrGetFromWebfinger } from '../../activi import { sendFollow } from '../../activitypub/send' import { Notifier } from '../../notifier' -async function processActivityPubFollow (job: Bull.Job) { +async function processActivityPubFollow (job: Job) { const payload = job.data as ActivitypubFollowPayload const host = payload.host diff --git a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts index d4b328635..9b0bb6574 100644 --- a/server/lib/job-queue/handlers/activitypub-http-broadcast.ts +++ b/server/lib/job-queue/handlers/activitypub-http-broadcast.ts @@ -1,5 +1,5 @@ -import * as Bluebird from 'bluebird' -import * as Bull from 'bull' +import { map } from 'bluebird' +import { Job } from 'bull' import { ActivitypubHttpBroadcastPayload } from '@shared/models' import { logger } from '../../../helpers/logger' import { doRequest } from '../../../helpers/requests' @@ -7,7 +7,7 @@ import { BROADCAST_CONCURRENCY } from '../../../initializers/constants' import { ActorFollowScoreCache } from '../../files-cache' import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' -async function processActivityPubHttpBroadcast (job: Bull.Job) { +async function processActivityPubHttpBroadcast (job: Job) { logger.info('Processing ActivityPub broadcast in job %d.', job.id) const payload = job.data as ActivitypubHttpBroadcastPayload @@ -25,7 +25,7 @@ async function processActivityPubHttpBroadcast (job: Bull.Job) { const badUrls: string[] = [] const goodUrls: string[] = [] - await Bluebird.map(payload.uris, uri => { + await map(payload.uris, uri => { return doRequest(uri, options) .then(() => goodUrls.push(uri)) .catch(() => badUrls.push(uri)) diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts index ab9675cae..46016a0a7 100644 --- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts +++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' import { logger } from '../../../helpers/logger' import { AccountVideoRateModel } from '../../../models/account/account-video-rate' @@ -13,7 +13,7 @@ import { addVideoShares } from '../../activitypub/share' import { addVideoComments } from '../../activitypub/video-comments' import { createRates } from '../../activitypub/video-rates' -async function processActivityPubHttpFetcher (job: Bull.Job) { +async function processActivityPubHttpFetcher (job: Job) { logger.info('Processing ActivityPub fetcher in job %d.', job.id) const payload = job.data as ActivitypubHttpFetcherPayload diff --git a/server/lib/job-queue/handlers/activitypub-http-unicast.ts b/server/lib/job-queue/handlers/activitypub-http-unicast.ts index 9e561c6b7..9be50837f 100644 --- a/server/lib/job-queue/handlers/activitypub-http-unicast.ts +++ b/server/lib/job-queue/handlers/activitypub-http-unicast.ts @@ -1,11 +1,11 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { ActivitypubHttpUnicastPayload } from '@shared/models' import { logger } from '../../../helpers/logger' import { doRequest } from '../../../helpers/requests' import { ActorFollowScoreCache } from '../../files-cache' import { buildGlobalHeaders, buildSignedRequestOptions, computeBody } from './utils/activitypub-http-utils' -async function processActivityPubHttpUnicast (job: Bull.Job) { +async function processActivityPubHttpUnicast (job: Job) { logger.info('Processing ActivityPub unicast in job %d.', job.id) const payload = job.data as ActivitypubHttpUnicastPayload diff --git a/server/lib/job-queue/handlers/activitypub-refresher.ts b/server/lib/job-queue/handlers/activitypub-refresher.ts index d97e50ebc..5037992d2 100644 --- a/server/lib/job-queue/handlers/activitypub-refresher.ts +++ b/server/lib/job-queue/handlers/activitypub-refresher.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlists' import { refreshVideoIfNeeded } from '@server/lib/activitypub/videos' import { loadVideoByUrl } from '@server/lib/model-loaders' @@ -8,7 +8,7 @@ import { ActorModel } from '../../../models/actor/actor' import { VideoPlaylistModel } from '../../../models/video/video-playlist' import { refreshActorIfNeeded } from '../../activitypub/actors' -async function refreshAPObject (job: Bull.Job) { +async function refreshAPObject (job: Job) { const payload = job.data as RefreshPayload logger.info('Processing AP refresher in job %d for %s.', job.id, payload.url) diff --git a/server/lib/job-queue/handlers/actor-keys.ts b/server/lib/job-queue/handlers/actor-keys.ts index 60ac61afd..9d5a65376 100644 --- a/server/lib/job-queue/handlers/actor-keys.ts +++ b/server/lib/job-queue/handlers/actor-keys.ts @@ -1,10 +1,10 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { generateAndSaveActorKeys } from '@server/lib/activitypub/actors' import { ActorModel } from '@server/models/actor/actor' import { ActorKeysPayload } from '@shared/models' import { logger } from '../../../helpers/logger' -async function processActorKeys (job: Bull.Job) { +async function processActorKeys (job: Job) { const payload = job.data as ActorKeysPayload logger.info('Processing actor keys in job %d.', job.id) diff --git a/server/lib/job-queue/handlers/email.ts b/server/lib/job-queue/handlers/email.ts index 3157731e2..6fc1caa84 100644 --- a/server/lib/job-queue/handlers/email.ts +++ b/server/lib/job-queue/handlers/email.ts @@ -1,9 +1,9 @@ -import * as Bull from 'bull' +import { Job } from 'bull' +import { EmailPayload } from '@shared/models' import { logger } from '../../../helpers/logger' import { Emailer } from '../../emailer' -import { EmailPayload } from '@shared/models' -async function processEmail (job: Bull.Job) { +async function processEmail (job: Job) { const payload = job.data as EmailPayload logger.info('Processing email in job %d.', job.id) diff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/lib/job-queue/handlers/move-to-object-storage.ts index f3b8726eb..0bebc0fc2 100644 --- a/server/lib/job-queue/handlers/move-to-object-storage.ts +++ b/server/lib/job-queue/handlers/move-to-object-storage.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { remove } from 'fs-extra' import { join } from 'path' import { logger } from '@server/helpers/logger' @@ -12,7 +12,7 @@ import { VideoJobInfoModel } from '@server/models/video/video-job-info' import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoWithAllFiles } from '@server/types/models' import { MoveObjectStoragePayload, VideoStorage } from '../../../../shared' -export async function processMoveToObjectStorage (job: Bull.Job) { +export async function processMoveToObjectStorage (job: Job) { const payload = job.data as MoveObjectStoragePayload logger.info('Moving video %s in job %d.', payload.videoUUID, job.id) diff --git a/server/lib/job-queue/handlers/video-file-import.ts b/server/lib/job-queue/handlers/video-file-import.ts index e8ee1f759..e6c918e6c 100644 --- a/server/lib/job-queue/handlers/video-file-import.ts +++ b/server/lib/job-queue/handlers/video-file-import.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { copy, stat } from 'fs-extra' import { getLowercaseExtension } from '@server/helpers/core-utils' import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' @@ -16,7 +16,7 @@ import { VideoModel } from '../../../models/video/video' import { VideoFileModel } from '../../../models/video/video-file' import { createHlsJobIfEnabled } from './video-transcoding' -async function processVideoFileImport (job: Bull.Job) { +async function processVideoFileImport (job: Job) { const payload = job.data as VideoFileImportPayload logger.info('Processing video file import in job %d.', job.id) diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index a5fa204f5..bdbf07a06 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { move, remove, stat } from 'fs-extra' import { getLowercaseExtension } from '@server/helpers/core-utils' import { retryTransactionWrapper } from '@server/helpers/database-utils' @@ -37,7 +37,7 @@ import { federateVideoIfNeeded } from '../../activitypub/videos' import { Notifier } from '../../notifier' import { generateVideoMiniature } from '../../thumbnail' -async function processVideoImport (job: Bull.Job) { +async function processVideoImport (job: Job) { const payload = job.data as VideoImportPayload if (payload.type === 'youtube-dl') return processYoutubeDLImport(job, payload) @@ -52,7 +52,7 @@ export { // --------------------------------------------------------------------------- -async function processTorrentImport (job: Bull.Job, payload: VideoImportTorrentPayload) { +async function processTorrentImport (job: Job, payload: VideoImportTorrentPayload) { logger.info('Processing torrent video import in job %d.', job.id) const videoImport = await getVideoImportOrDie(payload.videoImportId) @@ -68,7 +68,7 @@ async function processTorrentImport (job: Bull.Job, payload: VideoImportTorrentP return processFile(() => downloadWebTorrentVideo(target, VIDEO_IMPORT_TIMEOUT), videoImport, options) } -async function processYoutubeDLImport (job: Bull.Job, payload: VideoImportYoutubeDLPayload) { +async function processYoutubeDLImport (job: Job, payload: VideoImportYoutubeDLPayload) { logger.info('Processing youtubeDL video import in job %d.', job.id) const videoImport = await getVideoImportOrDie(payload.videoImportId) diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts index 9ccf724c2..a04cfa2c9 100644 --- a/server/lib/job-queue/handlers/video-live-ending.ts +++ b/server/lib/job-queue/handlers/video-live-ending.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { pathExists, readdir, remove } from 'fs-extra' import { join } from 'path' import { ffprobePromise, getAudioStream, getDurationFromVideoFile, getVideoFileResolution } from '@server/helpers/ffprobe-utils' @@ -17,7 +17,7 @@ import { MStreamingPlaylist, MVideo, MVideoLive } from '@server/types/models' import { ThumbnailType, VideoLiveEndingPayload, VideoState } from '@shared/models' import { logger } from '../../../helpers/logger' -async function processVideoLiveEnding (job: Bull.Job) { +async function processVideoLiveEnding (job: Job) { const payload = job.data as VideoLiveEndingPayload function logError () { diff --git a/server/lib/job-queue/handlers/video-redundancy.ts b/server/lib/job-queue/handlers/video-redundancy.ts index 6296dab05..9cb7a6589 100644 --- a/server/lib/job-queue/handlers/video-redundancy.ts +++ b/server/lib/job-queue/handlers/video-redundancy.ts @@ -1,9 +1,9 @@ -import * as Bull from 'bull' -import { logger } from '../../../helpers/logger' +import { Job } from 'bull' import { VideosRedundancyScheduler } from '@server/lib/schedulers/videos-redundancy-scheduler' import { VideoRedundancyPayload } from '@shared/models' +import { logger } from '../../../helpers/logger' -async function processVideoRedundancy (job: Bull.Job) { +async function processVideoRedundancy (job: Job) { const payload = job.data as VideoRedundancyPayload logger.info('Processing video redundancy in job %d.', job.id) diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 5a93c4ed1..20880cdc1 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts @@ -1,4 +1,4 @@ -import * as Bull from 'bull' +import { Job } from 'bull' import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils' import { addTranscodingJob, getTranscodingJobPriority } from '@server/lib/video' import { VideoPathManager } from '@server/lib/video-path-manager' @@ -25,7 +25,7 @@ import { transcodeNewWebTorrentResolution } from '../../transcoding/video-transcoding' -type HandlerFunction = (job: Bull.Job, payload: VideoTranscodingPayload, video: MVideoFullLight, user: MUser) => Promise +type HandlerFunction = (job: Job, payload: VideoTranscodingPayload, video: MVideoFullLight, user: MUser) => Promise const handlers: { [ id in VideoTranscodingPayload['type'] ]: HandlerFunction } = { 'new-resolution-to-hls': handleHLSJob, @@ -36,7 +36,7 @@ const handlers: { [ id in VideoTranscodingPayload['type'] ]: HandlerFunction } = const lTags = loggerTagsFactory('transcoding') -async function processVideoTranscoding (job: Bull.Job) { +async function processVideoTranscoding (job: Job) { const payload = job.data as VideoTranscodingPayload logger.info('Processing transcoding job %d.', job.id, lTags(payload.videoUUID)) @@ -64,7 +64,7 @@ async function processVideoTranscoding (job: Bull.Job) { // Job handlers // --------------------------------------------------------------------------- -async function handleHLSJob (job: Bull.Job, payload: HLSTranscodingPayload, video: MVideoFullLight, user: MUser) { +async function handleHLSJob (job: Job, payload: HLSTranscodingPayload, video: MVideoFullLight, user: MUser) { logger.info('Handling HLS transcoding job for %s.', video.uuid, lTags(video.uuid)) const videoFileInput = payload.copyCodecs @@ -90,7 +90,7 @@ async function handleHLSJob (job: Bull.Job, payload: HLSTranscodingPayload, vide } async function handleNewWebTorrentResolutionJob ( - job: Bull.Job, + job: Job, payload: NewResolutionTranscodingPayload, video: MVideoFullLight, user: MUserId @@ -104,7 +104,7 @@ async function handleNewWebTorrentResolutionJob ( await retryTransactionWrapper(onNewWebTorrentFileResolution, video, user, payload) } -async function handleWebTorrentMergeAudioJob (job: Bull.Job, payload: MergeAudioTranscodingPayload, video: MVideoFullLight, user: MUserId) { +async function handleWebTorrentMergeAudioJob (job: Job, payload: MergeAudioTranscodingPayload, video: MVideoFullLight, user: MUserId) { logger.info('Handling merge audio transcoding job for %s.', video.uuid, lTags(video.uuid)) await mergeAudioVideofile(video, payload.resolution, job) @@ -114,7 +114,7 @@ async function handleWebTorrentMergeAudioJob (job: Bull.Job, payload: MergeAudio await retryTransactionWrapper(onVideoFileOptimizer, video, payload, 'video', user) } -async function handleWebTorrentOptimizeJob (job: Bull.Job, payload: OptimizeTranscodingPayload, video: MVideoFullLight, user: MUserId) { +async function handleWebTorrentOptimizeJob (job: Job, payload: OptimizeTranscodingPayload, video: MVideoFullLight, user: MUserId) { logger.info('Handling optimize transcoding job for %s.', video.uuid, lTags(video.uuid)) const { transcodeType } = await optimizeOriginalVideofile(video, video.getMaxQualityFile(), job) -- cgit v1.2.3