diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-22 20:58:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-25 17:32:16 +0200 |
commit | e02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch) | |
tree | b7f6269913cd5a0e4f26a9461a043deb0c168be0 /server/helpers | |
parent | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff) | |
download | PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip |
Type models
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/database-utils.ts | 4 | ||||
-rw-r--r-- | server/helpers/logger.ts | 7 | ||||
-rw-r--r-- | server/helpers/utils.ts | 9 |
3 files changed, 10 insertions, 10 deletions
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts index b842ab9ec..7d6ce4ec8 100644 --- a/server/helpers/database-utils.ts +++ b/server/helpers/database-utils.ts | |||
@@ -1,7 +1,7 @@ | |||
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 |
2 | import retry = require('async/retry') | 2 | import retry = require('async/retry') |
3 | 3 | ||
4 | const db = require('../initializers/database') | 4 | import { database as db } from '../initializers/database' |
5 | import { logger } from './logger' | 5 | import { logger } from './logger' |
6 | 6 | ||
7 | function commitTransaction (t, callback) { | 7 | function commitTransaction (t, callback) { |
@@ -52,7 +52,7 @@ function transactionRetryer (func, callback) { | |||
52 | } | 52 | } |
53 | 53 | ||
54 | function startSerializableTransaction (callback) { | 54 | function startSerializableTransaction (callback) { |
55 | db.sequelize.transaction({ isolationLevel: 'SERIALIZABLE' }).asCallback(function (err, t) { | 55 | db.sequelize.transaction(/* { isolationLevel: 'SERIALIZABLE' } */).asCallback(function (err, t) { |
56 | // We force to return only two parameters | 56 | // We force to return only two parameters |
57 | return callback(err, t) | 57 | return callback(err, t) |
58 | }) | 58 | }) |
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 3c35e41e0..7c99db55f 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts | |||
@@ -36,13 +36,6 @@ const logger = new winston.Logger({ | |||
36 | exitOnError: true | 36 | exitOnError: true |
37 | }) | 37 | }) |
38 | 38 | ||
39 | // TODO: useful? | ||
40 | // logger.stream = { | ||
41 | // write: function (message) { | ||
42 | // logger.info(message) | ||
43 | // } | ||
44 | // } | ||
45 | |||
46 | // --------------------------------------------------------------------------- | 39 | // --------------------------------------------------------------------------- |
47 | 40 | ||
48 | export { logger } | 41 | export { logger } |
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index 09c35a533..bc76cfb26 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { pseudoRandomBytes } from 'crypto' | 1 | import { pseudoRandomBytes } from 'crypto' |
2 | import { join } from 'path' | ||
2 | 3 | ||
3 | import { logger } from './logger' | 4 | import { logger } from './logger' |
4 | 5 | ||
@@ -42,6 +43,11 @@ function getFormatedObjects (objects, objectsTotal) { | |||
42 | } | 43 | } |
43 | } | 44 | } |
44 | 45 | ||
46 | function root () { | ||
47 | // We are in /dist/helpers/utils.js | ||
48 | return join(__dirname, '..', '..', '..') | ||
49 | } | ||
50 | |||
45 | // --------------------------------------------------------------------------- | 51 | // --------------------------------------------------------------------------- |
46 | 52 | ||
47 | export { | 53 | export { |
@@ -50,5 +56,6 @@ export { | |||
50 | cleanForExit, | 56 | cleanForExit, |
51 | generateRandomString, | 57 | generateRandomString, |
52 | isTestInstance, | 58 | isTestInstance, |
53 | getFormatedObjects | 59 | getFormatedObjects, |
60 | root | ||
54 | } | 61 | } |