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/activitypub/videos.ts | |
parent | 3cd0734fd9b0ff21aaef02317a874e8f1c06e027 (diff) | |
download | PeerTube-90d4bb8125e80c8060416d4d135ddeaf0a622ede.tar.gz PeerTube-90d4bb8125e80c8060416d4d135ddeaf0a622ede.tar.zst PeerTube-90d4bb8125e80c8060416d4d135ddeaf0a622ede.zip |
Refractor retry transaction function
Diffstat (limited to 'server/lib/activitypub/videos.ts')
-rw-r--r-- | server/lib/activitypub/videos.ts | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 7ec8ca193..a16828fda 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -228,12 +228,7 @@ async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentOb | |||
228 | 228 | ||
229 | const channelActor = await getOrCreateVideoChannel(videoObject) | 229 | const channelActor = await getOrCreateVideoChannel(videoObject) |
230 | 230 | ||
231 | const options = { | 231 | const video = await retryTransactionWrapper(getOrCreateVideo, videoObject, channelActor) |
232 | arguments: [ videoObject, channelActor ], | ||
233 | errorMessage: 'Cannot insert the remote video with many retries.' | ||
234 | } | ||
235 | |||
236 | const video = await retryTransactionWrapper(getOrCreateVideo, options) | ||
237 | 232 | ||
238 | // Process outside the transaction because we could fetch remote data | 233 | // Process outside the transaction because we could fetch remote data |
239 | logger.info('Adding likes of video %s.', video.uuid) | 234 | logger.info('Adding likes of video %s.', video.uuid) |