diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-13 14:27:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-13 14:27:40 +0200 |
commit | 90d4bb8125e80c8060416d4d135ddeaf0a622ede (patch) | |
tree | b3b7181329a08ecc930b54fe7b48095c4155393c /server/lib/job-queue | |
parent | 3cd0734fd9b0ff21aaef02317a874e8f1c06e027 (diff) | |
download | PeerTube-90d4bb8125e80c8060416d4d135ddeaf0a622ede.tar.gz PeerTube-90d4bb8125e80c8060416d4d135ddeaf0a622ede.tar.zst PeerTube-90d4bb8125e80c8060416d4d135ddeaf0a622ede.zip |
Refractor retry transaction function
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-follow.ts | 6 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/video-file.ts | 12 |
2 files changed, 3 insertions, 15 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-follow.ts b/server/lib/job-queue/handlers/activitypub-follow.ts index 6764a4037..286e343f2 100644 --- a/server/lib/job-queue/handlers/activitypub-follow.ts +++ b/server/lib/job-queue/handlers/activitypub-follow.ts | |||
@@ -26,12 +26,8 @@ async function processActivityPubFollow (job: kue.Job) { | |||
26 | const targetActor = await getOrCreateActorAndServerAndModel(actorUrl) | 26 | const targetActor = await getOrCreateActorAndServerAndModel(actorUrl) |
27 | 27 | ||
28 | const fromActor = await getServerActor() | 28 | const fromActor = await getServerActor() |
29 | const options = { | ||
30 | arguments: [ fromActor, targetActor ], | ||
31 | errorMessage: 'Cannot follow with many retries.' | ||
32 | } | ||
33 | 29 | ||
34 | return retryTransactionWrapper(follow, options) | 30 | return retryTransactionWrapper(follow, fromActor, targetActor) |
35 | } | 31 | } |
36 | // --------------------------------------------------------------------------- | 32 | // --------------------------------------------------------------------------- |
37 | 33 | ||
diff --git a/server/lib/job-queue/handlers/video-file.ts b/server/lib/job-queue/handlers/video-file.ts index f5ad076a6..a5c6bf300 100644 --- a/server/lib/job-queue/handlers/video-file.ts +++ b/server/lib/job-queue/handlers/video-file.ts | |||
@@ -52,19 +52,11 @@ async function processVideoFile (job: kue.Job) { | |||
52 | if (payload.resolution) { | 52 | if (payload.resolution) { |
53 | await video.transcodeOriginalVideofile(payload.resolution, payload.isPortraitMode) | 53 | await video.transcodeOriginalVideofile(payload.resolution, payload.isPortraitMode) |
54 | 54 | ||
55 | const options = { | 55 | await retryTransactionWrapper(onVideoFileTranscoderOrImportSuccess, video) |
56 | arguments: [ video ], | ||
57 | errorMessage: 'Cannot execute onVideoFileTranscoderOrImportSuccess with many retries.' | ||
58 | } | ||
59 | await retryTransactionWrapper(onVideoFileTranscoderOrImportSuccess, options) | ||
60 | } else { | 56 | } else { |
61 | await video.optimizeOriginalVideofile() | 57 | await video.optimizeOriginalVideofile() |
62 | 58 | ||
63 | const options = { | 59 | await retryTransactionWrapper(onVideoFileOptimizerSuccess, video, payload.isNewVideo) |
64 | arguments: [ video, payload.isNewVideo ], | ||
65 | errorMessage: 'Cannot execute onVideoFileOptimizerSuccess with many retries.' | ||
66 | } | ||
67 | await retryTransactionWrapper(onVideoFileOptimizerSuccess, options) | ||
68 | } | 60 | } |
69 | 61 | ||
70 | return video | 62 | return video |