Retry transactions on user endpoints if needed
authorChocobozzz <me@florianbigard.com>
Thu, 13 Sep 2018 08:22:14 +0000 (10:22 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 13 Sep 2018 08:22:14 +0000 (10:22 +0200)
server/controllers/api/users/me.ts

index 0f18b42f92a688e3a041b8258bd491c75fed00eb..e886d4b2ad8e34935b6e1881476145ae3f1a19af 100644 (file)
@@ -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)
 )
 
 // ---------------------------------------------------------------------------