mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Refractor retry transaction function
This commit is contained in:
parent
3cd0734fd9
commit
90d4bb8125
19 changed files with 162 additions and 415 deletions
|
@ -11,7 +11,7 @@ async function processFollowActivity (activity: ActivityFollow) {
|
|||
const activityObject = activity.object
|
||||
const actor = await getOrCreateActorAndServerAndModel(activity.actor)
|
||||
|
||||
return processFollow(actor, activityObject)
|
||||
return retryTransactionWrapper(processFollow, actor, activityObject)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -22,16 +22,7 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function processFollow (actor: ActorModel, targetActorURL: string) {
|
||||
const options = {
|
||||
arguments: [ actor, targetActorURL ],
|
||||
errorMessage: 'Cannot follow with many retries.'
|
||||
}
|
||||
|
||||
return retryTransactionWrapper(follow, options)
|
||||
}
|
||||
|
||||
async function follow (actor: ActorModel, targetActorURL: string) {
|
||||
async function processFollow (actor: ActorModel, targetActorURL: string) {
|
||||
await sequelizeTypescript.transaction(async t => {
|
||||
const targetActor = await ActorModel.loadByUrl(targetActorURL, t)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue