diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-08 15:48:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-09 09:18:07 +0200 |
commit | bd911b54b555b11df7e9849cf92d358bccfecf6e (patch) | |
tree | 23e94b4acbe6819fedc1cb5e067b700cbdd880c3 /server/lib/activitypub | |
parent | 5a921e7b74910414626bfc9672b857e987e3ebed (diff) | |
download | PeerTube-bd911b54b555b11df7e9849cf92d358bccfecf6e.tar.gz PeerTube-bd911b54b555b11df7e9849cf92d358bccfecf6e.tar.zst PeerTube-bd911b54b555b11df7e9849cf92d358bccfecf6e.zip |
Use bullmq job dependency
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/actors/get.ts | 4 | ||||
-rw-r--r-- | server/lib/activitypub/follow.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/outbox.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/playlists/refresh.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/send/shared/send-utils.ts | 8 | ||||
-rw-r--r-- | server/lib/activitypub/videos/get.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/videos/shared/video-sync-attributes.ts | 2 |
7 files changed, 11 insertions, 11 deletions
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) | |||
110 | async function scheduleOutboxFetchIfNeeded (actor: MActor, created: boolean, refreshed: boolean, updateCollections: boolean) { | 110 | async function scheduleOutboxFetchIfNeeded (actor: MActor, created: boolean, refreshed: boolean, updateCollections: boolean) { |
111 | if ((created === true || refreshed === true) && updateCollections === true) { | 111 | if ((created === true || refreshed === true) && updateCollections === true) { |
112 | const payload = { uri: actor.outboxUrl, type: 'activity' as 'activity' } | 112 | const payload = { uri: actor.outboxUrl, type: 'activity' as 'activity' } |
113 | await JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload }) | 113 | await JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
@@ -118,6 +118,6 @@ async function schedulePlaylistFetchIfNeeded (actor: MActorAccountId, created: b | |||
118 | // We created a new account: fetch the playlists | 118 | // We created a new account: fetch the playlists |
119 | if (created === true && actor.Account && accountPlaylistsUrl) { | 119 | if (created === true && actor.Account && accountPlaylistsUrl) { |
120 | const payload = { uri: accountPlaylistsUrl, type: 'account-playlists' as 'account-playlists' } | 120 | const payload = { uri: accountPlaylistsUrl, type: 'account-playlists' as 'account-playlists' } |
121 | await JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload }) | 121 | await JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) |
122 | } | 122 | } |
123 | } | 123 | } |
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 | |||
27 | isAutoFollow: true | 27 | isAutoFollow: true |
28 | } | 28 | } |
29 | 29 | ||
30 | JobQueue.Instance.createJob({ type: 'activitypub-follow', payload }) | 30 | JobQueue.Instance.createJobAsync({ type: 'activitypub-follow', payload }) |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
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<ActorModel, 'id' | 'outboxUrl'>) { | |||
16 | type: 'activity' as 'activity' | 16 | type: 'activity' as 'activity' |
17 | } | 17 | } |
18 | 18 | ||
19 | return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) | 19 | return JobQueue.Instance.createJobAsync({ type: 'activitypub-http-fetcher', payload }) |
20 | } | 20 | } |
21 | 21 | ||
22 | export { | 22 | 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' | |||
9 | function scheduleRefreshIfNeeded (playlist: MVideoPlaylist) { | 9 | function scheduleRefreshIfNeeded (playlist: MVideoPlaylist) { |
10 | if (!playlist.isOutdated()) return | 10 | if (!playlist.isOutdated()) return |
11 | 11 | ||
12 | JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'video-playlist', url: playlist.url } }) | 12 | JobQueue.Instance.createJobAsync({ type: 'activitypub-refresher', payload: { type: 'video-playlist', url: playlist.url } }) |
13 | } | 13 | } |
14 | 14 | ||
15 | async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner): Promise<MVideoPlaylistOwner> { | 15 | async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner): Promise<MVideoPlaylistOwner> { |
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 ( | |||
120 | body: activity, | 120 | body: activity, |
121 | contextType: null | 121 | contextType: null |
122 | } | 122 | } |
123 | return afterCommitIfTransaction(t, () => JobQueue.Instance.createJob({ type: 'activitypub-http-broadcast', payload })) | 123 | return afterCommitIfTransaction(t, () => JobQueue.Instance.createJobAsync({ type: 'activitypub-http-broadcast', payload })) |
124 | } | 124 | } |
125 | 125 | ||
126 | // --------------------------------------------------------------------------- | 126 | // --------------------------------------------------------------------------- |
@@ -205,7 +205,7 @@ function broadcastTo (options: { | |||
205 | contextType | 205 | contextType |
206 | } | 206 | } |
207 | 207 | ||
208 | JobQueue.Instance.createJob({ | 208 | JobQueue.Instance.createJobAsync({ |
209 | type: parallelizable | 209 | type: parallelizable |
210 | ? 'activitypub-http-broadcast-parallel' | 210 | ? 'activitypub-http-broadcast-parallel' |
211 | : 'activitypub-http-broadcast', | 211 | : 'activitypub-http-broadcast', |
@@ -222,7 +222,7 @@ function broadcastTo (options: { | |||
222 | contextType | 222 | contextType |
223 | } | 223 | } |
224 | 224 | ||
225 | JobQueue.Instance.createJob({ type: 'activitypub-http-unicast', payload }) | 225 | JobQueue.Instance.createJobAsync({ type: 'activitypub-http-unicast', payload }) |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
@@ -243,7 +243,7 @@ function unicastTo (options: { | |||
243 | contextType | 243 | contextType |
244 | } | 244 | } |
245 | 245 | ||
246 | JobQueue.Instance.createJob({ type: 'activitypub-http-unicast', payload }) | 246 | JobQueue.Instance.createJobAsync({ type: 'activitypub-http-unicast', payload }) |
247 | } | 247 | } |
248 | 248 | ||
249 | // --------------------------------------------------------------------------- | 249 | // --------------------------------------------------------------------------- |
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 | |||
107 | return refreshVideoIfNeeded(refreshOptions) | 107 | return refreshVideoIfNeeded(refreshOptions) |
108 | } | 108 | } |
109 | 109 | ||
110 | await JobQueue.Instance.createJobWithPromise({ | 110 | await JobQueue.Instance.createJob({ |
111 | type: 'activitypub-refresher', | 111 | type: 'activitypub-refresher', |
112 | payload: { type: 'video', url: video.url } | 112 | payload: { type: 'video', url: video.url } |
113 | }) | 113 | }) |
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 | |||
74 | } | 74 | } |
75 | 75 | ||
76 | function createJob (payload: ActivitypubHttpFetcherPayload) { | 76 | function createJob (payload: ActivitypubHttpFetcherPayload) { |
77 | return JobQueue.Instance.createJobWithPromise({ type: 'activitypub-http-fetcher', payload }) | 77 | return JobQueue.Instance.createJob({ type: 'activitypub-http-fetcher', payload }) |
78 | } | 78 | } |
79 | 79 | ||
80 | function syncShares (video: MVideo, fetchedVideo: VideoObject, isSync: boolean) { | 80 | function syncShares (video: MVideo, fetchedVideo: VideoObject, isSync: boolean) { |