From 176e2114533e60dfc20dc4733ce57016e77b9eba Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Thu, 13 Sep 2018 10:22:14 +0200
Subject: Retry transactions on user endpoints if needed

---
 server/controllers/api/users/me.ts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'server/controllers')

diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 0f18b42f9..e886d4b2a 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -5,7 +5,7 @@ import { getFormattedObjects } from '../../../helpers/utils'
 import { CONFIG, IMAGE_MIMETYPE_EXT, sequelizeTypescript } from '../../../initializers'
 import { sendUpdateActor } from '../../../lib/activitypub/send'
 import {
-  asyncMiddleware,
+  asyncMiddleware, asyncRetryTransactionMiddleware,
   authenticate,
   commonVideosFiltersValidator,
   paginationValidator,
@@ -86,14 +86,14 @@ meRouter.get('/me/videos/:videoId/rating',
 meRouter.put('/me',
   authenticate,
   usersUpdateMeValidator,
-  asyncMiddleware(updateMe)
+  asyncRetryTransactionMiddleware(updateMe)
 )
 
 meRouter.post('/me/avatar/pick',
   authenticate,
   reqAvatarFile,
   updateAvatarValidator,
-  asyncMiddleware(updateMyAvatar)
+  asyncRetryTransactionMiddleware(updateMyAvatar)
 )
 
 // ##### Subscriptions part #####
@@ -138,7 +138,7 @@ meRouter.get('/me/subscriptions/:uri',
 meRouter.delete('/me/subscriptions/:uri',
   authenticate,
   userSubscriptionGetValidator,
-  asyncMiddleware(deleteUserSubscription)
+  asyncRetryTransactionMiddleware(deleteUserSubscription)
 )
 
 // ---------------------------------------------------------------------------
-- 
cgit v1.2.3