aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/database-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-16 15:22:39 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit20494f122186bb1bfd82f4c598c4744acea27b0c (patch)
tree097652a31ecf70491b970b6c8e06b22380ee004f /server/helpers/database-utils.ts
parentefc32059d980c51793e8e9ac0fb6a885a8026f94 (diff)
downloadPeerTube-20494f122186bb1bfd82f4c598c4744acea27b0c.tar.gz
PeerTube-20494f122186bb1bfd82f4c598c4744acea27b0c.tar.zst
PeerTube-20494f122186bb1bfd82f4c598c4744acea27b0c.zip
Server shares user videos
Diffstat (limited to 'server/helpers/database-utils.ts')
-rw-r--r--server/helpers/database-utils.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts
index d62462d35..169b80065 100644
--- a/server/helpers/database-utils.ts
+++ b/server/helpers/database-utils.ts
@@ -1,10 +1,10 @@
1// TODO: import from ES6 when retry typing file will include errorFilter function 1// TODO: import from ES6 when retry typing file will include errorFilter function
2import * as retry from 'async/retry' 2import * as retry from 'async/retry'
3 3import * as Bluebird from 'bluebird'
4import { logger } from './logger' 4import { logger } from './logger'
5 5
6type RetryTransactionWrapperOptions = { errorMessage: string, arguments?: any[] } 6type RetryTransactionWrapperOptions = { errorMessage: string, arguments?: any[] }
7function retryTransactionWrapper (functionToRetry: (...args) => Promise<any>, options: RetryTransactionWrapperOptions) { 7function retryTransactionWrapper (functionToRetry: (...args) => Promise<any> | Bluebird<any>, options: RetryTransactionWrapperOptions) {
8 const args = options.arguments ? options.arguments : [] 8 const args = options.arguments ? options.arguments : []
9 9
10 return transactionRetryer(callback => { 10 return transactionRetryer(callback => {
@@ -13,8 +13,8 @@ function retryTransactionWrapper (functionToRetry: (...args) => Promise<any>, op
13 .catch(err => callback(err)) 13 .catch(err => callback(err))
14 }) 14 })
15 .catch(err => { 15 .catch(err => {
16 // Do not throw the error, continue the process
17 logger.error(options.errorMessage, err) 16 logger.error(options.errorMessage, err)
17 throw err
18 }) 18 })
19} 19}
20 20
@@ -28,7 +28,7 @@ function transactionRetryer (func: Function) {
28 logger.debug('Maybe retrying the transaction function.', { willRetry }) 28 logger.debug('Maybe retrying the transaction function.', { willRetry })
29 return willRetry 29 return willRetry
30 } 30 }
31 }, func, err => err ? rej(err) : res()) 31 }, func, (err, data) => err ? rej(err) : res(data))
32 }) 32 })
33} 33}
34 34