From bd911b54b555b11df7e9849cf92d358bccfecf6e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Aug 2022 15:48:17 +0200 Subject: Use bullmq job dependency --- server/lib/activitypub/actors/get.ts | 4 ++-- server/lib/activitypub/follow.ts | 2 +- server/lib/activitypub/outbox.ts | 2 +- server/lib/activitypub/playlists/refresh.ts | 2 +- server/lib/activitypub/send/shared/send-utils.ts | 8 ++++---- server/lib/activitypub/videos/get.ts | 2 +- server/lib/activitypub/videos/shared/video-sync-attributes.ts | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/actors/get.ts b/server/lib/activitypub/actors/get.ts index d2b651082..e73b7d707 100644 --- a/server/lib/activitypub/actors/get.ts +++ b/server/lib/activitypub/actors/get.ts @@ -110,7 +110,7 @@ async function loadActorFromDB (actorUrl: string, fetchType: ActorLoadByUrlType) async function scheduleOutboxFetchIfNeeded (actor: MActor, created: boolean, refreshed: boolean, updateCollections: boolean) { if ((created === true || refreshed === true) && updateCollections === true) { const payload = { uri: actor.outboxUrl, type: 'activity' as 'activity' } - await JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload }) + await JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) } } @@ -118,6 +118,6 @@ async function schedulePlaylistFetchIfNeeded (actor: MActorAccountId, created: b // We created a new account: fetch the playlists if (created === true && actor.Account && accountPlaylistsUrl) { const payload = { uri: accountPlaylistsUrl, type: 'account-playlists' as 'account-playlists' } - await JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload }) + await JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) } } diff --git a/server/lib/activitypub/follow.ts b/server/lib/activitypub/follow.ts index 741b54df5..f6e2a48fd 100644 --- a/server/lib/activitypub/follow.ts +++ b/server/lib/activitypub/follow.ts @@ -27,7 +27,7 @@ async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors, transact isAutoFollow: true } - JobQueue.Instance.createJob({ type: 'activitypub-follow', payload }) + JobQueue.Instance.createJobAsync({ type: 'activitypub-follow', payload }) } } diff --git a/server/lib/activitypub/outbox.ts b/server/lib/activitypub/outbox.ts index ecdc33a77..5eef76871 100644 --- a/server/lib/activitypub/outbox.ts +++ b/server/lib/activitypub/outbox.ts @@ -16,7 +16,7 @@ async function addFetchOutboxJob (actor: Pick) { type: 'activity' as 'activity' } - return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) + return JobQueue.Instance.createJobAsync({ type: 'activitypub-http-fetcher', payload }) } export { diff --git a/server/lib/activitypub/playlists/refresh.ts b/server/lib/activitypub/playlists/refresh.ts index 493e8c7ec..33260ea02 100644 --- a/server/lib/activitypub/playlists/refresh.ts +++ b/server/lib/activitypub/playlists/refresh.ts @@ -9,7 +9,7 @@ import { fetchRemoteVideoPlaylist } from './shared' function scheduleRefreshIfNeeded (playlist: MVideoPlaylist) { if (!playlist.isOutdated()) return - JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video-playlist', url: playlist.url } }) + JobQueue.Instance.createJobAsync({ type: 'activitypub-refresher', payload: { type: 'video-playlist', url: playlist.url } }) } async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner): Promise { diff --git a/server/lib/activitypub/send/shared/send-utils.ts b/server/lib/activitypub/send/shared/send-utils.ts index fcec63991..2bc1ef8f5 100644 --- a/server/lib/activitypub/send/shared/send-utils.ts +++ b/server/lib/activitypub/send/shared/send-utils.ts @@ -120,7 +120,7 @@ async function forwardActivity ( body: activity, contextType: null } - return afterCommitIfTransaction(t, () => JobQueue.Instance.createJob({ type: 'activitypub-http-broadcast', payload })) + return afterCommitIfTransaction(t, () => JobQueue.Instance.createJobAsync({ type: 'activitypub-http-broadcast', payload })) } // --------------------------------------------------------------------------- @@ -205,7 +205,7 @@ function broadcastTo (options: { contextType } - JobQueue.Instance.createJob({ + JobQueue.Instance.createJobAsync({ type: parallelizable ? 'activitypub-http-broadcast-parallel' : 'activitypub-http-broadcast', @@ -222,7 +222,7 @@ function broadcastTo (options: { contextType } - JobQueue.Instance.createJob({ type: 'activitypub-http-unicast', payload }) + JobQueue.Instance.createJobAsync({ type: 'activitypub-http-unicast', payload }) } } @@ -243,7 +243,7 @@ function unicastTo (options: { contextType } - JobQueue.Instance.createJob({ type: 'activitypub-http-unicast', payload }) + JobQueue.Instance.createJobAsync({ type: 'activitypub-http-unicast', payload }) } // --------------------------------------------------------------------------- diff --git a/server/lib/activitypub/videos/get.ts b/server/lib/activitypub/videos/get.ts index b74df132c..14ba55034 100644 --- a/server/lib/activitypub/videos/get.ts +++ b/server/lib/activitypub/videos/get.ts @@ -107,7 +107,7 @@ async function scheduleRefresh (video: MVideoThumbnail, fetchType: VideoLoadByUr return refreshVideoIfNeeded(refreshOptions) } - await JobQueue.Instance.createJobWithPromise({ + await JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video', url: video.url } }) diff --git a/server/lib/activitypub/videos/shared/video-sync-attributes.ts b/server/lib/activitypub/videos/shared/video-sync-attributes.ts index 8cf0c87a6..8ed1b6447 100644 --- a/server/lib/activitypub/videos/shared/video-sync-attributes.ts +++ b/server/lib/activitypub/videos/shared/video-sync-attributes.ts @@ -74,7 +74,7 @@ async function getRatesCount (type: 'like' | 'dislike', video: MVideo, fetchedVi } function createJob (payload: ActivitypubHttpFetcherPayload) { - return JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload }) + return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) } function syncShares (video: MVideo, fetchedVideo: VideoObject, isSync: boolean) { -- cgit v1.2.3