aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-29 11:59:29 +0200
committerChocobozzz <me@florianbigard.com>2019-07-29 13:40:39 +0200
commit2284f202070aa2e49156cc52b3b1596a7d5aadec (patch)
tree77aeb00016734667f8ff32a98ea8b4a6ed3ca31e /server/helpers
parent112be80ebdf96ef6a27420c1c6a10097388731a9 (diff)
downloadPeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.gz
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.zst
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.zip
Add gitlab ci support
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/database-utils.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts
index 39c74b2fd..6c5068fb0 100644
--- a/server/helpers/database-utils.ts
+++ b/server/helpers/database-utils.ts
@@ -2,6 +2,7 @@ import * as retry from 'async/retry'
2import * as Bluebird from 'bluebird' 2import * as Bluebird from 'bluebird'
3import { Model } from 'sequelize-typescript' 3import { Model } from 'sequelize-typescript'
4import { logger } from './logger' 4import { logger } from './logger'
5import { Transaction } from 'sequelize'
5 6
6function retryTransactionWrapper <T, A, B, C> ( 7function retryTransactionWrapper <T, A, B, C> (
7 functionToRetry: (arg1: A, arg2: B, arg3: C) => Promise<T> | Bluebird<T>, 8 functionToRetry: (arg1: A, arg2: B, arg3: C) => Promise<T> | Bluebird<T>,
@@ -72,11 +73,18 @@ function resetSequelizeInstance (instance: Model<any>, savedFields: object) {
72 }) 73 })
73} 74}
74 75
76function afterCommitIfTransaction (t: Transaction, fn: Function) {
77 if (t) return t.afterCommit(() => fn())
78
79 return fn()
80}
81
75// --------------------------------------------------------------------------- 82// ---------------------------------------------------------------------------
76 83
77export { 84export {
78 resetSequelizeInstance, 85 resetSequelizeInstance,
79 retryTransactionWrapper, 86 retryTransactionWrapper,
80 transactionRetryer, 87 transactionRetryer,
81 updateInstanceWithAnother 88 updateInstanceWithAnother,
89 afterCommitIfTransaction
82} 90}