1
0
Fork 0

Update standard -> 10

This commit is contained in:
Chocobozzz 2017-04-16 14:25:37 +02:00
parent 3758da9489
commit 0dd079da27
6 changed files with 21 additions and 14 deletions

View file

@ -6,7 +6,6 @@ const helpers = require('./helpers')
const AssetsPlugin = require('assets-webpack-plugin') const AssetsPlugin = require('assets-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin') const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin')
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin') const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin')
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin')

View file

@ -90,7 +90,7 @@
"devDependencies": { "devDependencies": {
"add-asset-html-webpack-plugin": "^1.0.2", "add-asset-html-webpack-plugin": "^1.0.2",
"codelyzer": "^2.0.0", "codelyzer": "^2.0.0",
"standard": "^9.0.0", "standard": "^10.0.0",
"webpack-bundle-analyzer": "^2.2.1", "webpack-bundle-analyzer": "^2.2.1",
"webpack-dll-bundles-plugin": "^1.0.0-beta.5" "webpack-dll-bundles-plugin": "^1.0.0-beta.5"
} }

View file

@ -64,7 +64,7 @@
"password-generator": "^2.0.2", "password-generator": "^2.0.2",
"pg": "^6.1.0", "pg": "^6.1.0",
"pg-hstore": "^2.3.2", "pg-hstore": "^2.3.2",
"request": "^2.57.0", "request": "^2.81.0",
"request-replay": "^1.0.2", "request-replay": "^1.0.2",
"rimraf": "^2.5.4", "rimraf": "^2.5.4",
"safe-buffer": "^5.0.1", "safe-buffer": "^5.0.1",
@ -77,7 +77,7 @@
"chai": "^3.3.0", "chai": "^3.3.0",
"commander": "^2.9.0", "commander": "^2.9.0",
"mocha": "^3.0.1", "mocha": "^3.0.1",
"standard": "^9.0.0", "standard": "^10.0.0",
"supertest": "^3.0.0", "supertest": "^3.0.0",
"webtorrent": "^0.98.0" "webtorrent": "^0.98.0"
}, },

View file

@ -74,7 +74,9 @@ function comparePassword (plainPassword, hashPassword, callback) {
} }
function createCertsIfNotExist (callback) { function createCertsIfNotExist (callback) {
certsExist(function (exist) { certsExist(function (err, exist) {
if (err) return callback(err)
if (exist === true) { if (exist === true) {
return callback(null) return callback(null)
} }
@ -113,13 +115,17 @@ module.exports = peertubeCrypto
function certsExist (callback) { function certsExist (callback) {
const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME) const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME)
fs.exists(certPath, function (exists) { fs.access(certPath, function (err) {
return callback(exists) // If there is an error the certificates do not exist
const exists = !err
return callback(null, exists)
}) })
} }
function createCerts (callback) { function createCerts (callback) {
certsExist(function (exist) { certsExist(function (err, exist) {
if (err) return callback(err)
if (exist === true) { if (exist === true) {
const string = 'Certs already exist.' const string = 'Certs already exist.'
logger.warning(string) logger.warning(string)

View file

@ -66,10 +66,10 @@ module.exports = class BaseRequestScheduler {
err = err ? err.message : 'Status code not 20x : ' + res.statusCode err = err ? err.message : 'Status code not 20x : ' + res.statusCode
logger.error('Error sending secure request to %s pod.', toPod.host, { error: err }) logger.error('Error sending secure request to %s pod.', toPod.host, { error: err })
return callback(false) return callback(err)
} }
return callback(true) return callback(null)
}) })
} }
@ -99,8 +99,8 @@ module.exports = class BaseRequestScheduler {
const requestToMake = requestsToMakeGrouped[hashKey] const requestToMake = requestsToMakeGrouped[hashKey]
const toPod = requestToMake.toPod const toPod = requestToMake.toPod
this.makeRequest(toPod, requestToMake.endpoint, requestToMake.datas, (success) => { this.makeRequest(toPod, requestToMake.endpoint, requestToMake.datas, (err) => {
if (success === false) { if (err) {
badPods.push(requestToMake.toPod.id) badPods.push(requestToMake.toPod.id)
return callbackEach() return callbackEach()
} }

View file

@ -102,7 +102,9 @@ runServers(numberOfPods, function (err, servers) {
checking = true checking = true
const waitingInterval = setInterval(function () { const waitingInterval = setInterval(function () {
isThereAwaitingRequests(servers, function (res) { isThereAwaitingRequests(servers, function (err, res) {
if (err) throw err
if (res === true) { if (res === true) {
console.log('A server has awaiting requests, waiting...') console.log('A server has awaiting requests, waiting...')
return return
@ -360,6 +362,6 @@ function isThereAwaitingRequests (servers, callback) {
}, function (err) { }, function (err) {
if (err) throw err if (err) throw err
return callback(noRequests === false) return callback(null, noRequests === false)
}) })
} }