diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 22:29:27 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-16 22:29:27 +0100 |
commit | f0f5567b6918fc60c8cab15e13aec03a89a91dfb (patch) | |
tree | 99dfdb9fa8273c9cda1360fd3b6bfccc515bf8be /server/lib/poolRequests.js | |
parent | 5101105ef91bfe478f97546b78b321882da2079c (diff) | |
download | PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.gz PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.tar.zst PeerTube-f0f5567b6918fc60c8cab15e13aec03a89a91dfb.zip |
Use const/let now we use node 4.2
Diffstat (limited to 'server/lib/poolRequests.js')
-rw-r--r-- | server/lib/poolRequests.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/server/lib/poolRequests.js b/server/lib/poolRequests.js index f786c3c7a..2eb501311 100644 --- a/server/lib/poolRequests.js +++ b/server/lib/poolRequests.js | |||
@@ -1,18 +1,18 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | var async = require('async') | 3 | const async = require('async') |
4 | var pluck = require('lodash-node/compat/collection/pluck') | 4 | const pluck = require('lodash-node/compat/collection/pluck') |
5 | 5 | ||
6 | var constants = require('../initializers/constants') | 6 | const constants = require('../initializers/constants') |
7 | var logger = require('../helpers/logger') | 7 | const logger = require('../helpers/logger') |
8 | var Pods = require('../models/pods') | 8 | const Pods = require('../models/pods') |
9 | var PoolRequests = require('../models/poolRequests') | 9 | const PoolRequests = require('../models/poolRequests') |
10 | var requests = require('../helpers/requests') | 10 | const requests = require('../helpers/requests') |
11 | var Videos = require('../models/videos') | 11 | const Videos = require('../models/videos') |
12 | 12 | ||
13 | var timer = null | 13 | let timer = null |
14 | 14 | ||
15 | var poolRequests = { | 15 | const poolRequests = { |
16 | activate: activate, | 16 | activate: activate, |
17 | addRequest: addRequest, | 17 | addRequest: addRequest, |
18 | deactivate: deactivate, | 18 | deactivate: deactivate, |
@@ -77,7 +77,7 @@ function makePoolRequest (type, requests_to_make, callback) { | |||
77 | Pods.list(function (err, pods) { | 77 | Pods.list(function (err, pods) { |
78 | if (err) return callback(err) | 78 | if (err) return callback(err) |
79 | 79 | ||
80 | var params = { | 80 | const params = { |
81 | encrypt: true, | 81 | encrypt: true, |
82 | sign: true, | 82 | sign: true, |
83 | method: 'POST', | 83 | method: 'POST', |
@@ -93,8 +93,8 @@ function makePoolRequest (type, requests_to_make, callback) { | |||
93 | return callback(new Error('Unkown pool request type.')) | 93 | return callback(new Error('Unkown pool request type.')) |
94 | } | 94 | } |
95 | 95 | ||
96 | var bad_pods = [] | 96 | const bad_pods = [] |
97 | var good_pods = [] | 97 | const good_pods = [] |
98 | 98 | ||
99 | requests.makeMultipleRetryRequest(params, pods, callbackEachPodFinished, callbackAllPodsFinished) | 99 | requests.makeMultipleRetryRequest(params, pods, callbackEachPodFinished, callbackAllPodsFinished) |
100 | 100 | ||
@@ -129,7 +129,7 @@ function makePoolRequests () { | |||
129 | 129 | ||
130 | if (pool_requests.length === 0) return | 130 | if (pool_requests.length === 0) return |
131 | 131 | ||
132 | var requests_to_make = { | 132 | const requests_to_make = { |
133 | add: { | 133 | add: { |
134 | ids: [], | 134 | ids: [], |
135 | requests: [] | 135 | requests: [] |
@@ -184,14 +184,14 @@ function removeBadPods () { | |||
184 | 184 | ||
185 | if (pods.length === 0) return | 185 | if (pods.length === 0) return |
186 | 186 | ||
187 | var urls = pluck(pods, 'url') | 187 | const urls = pluck(pods, 'url') |
188 | var ids = pluck(pods, '_id') | 188 | const ids = pluck(pods, '_id') |
189 | 189 | ||
190 | Videos.removeAllRemotesOf(urls, function (err, r) { | 190 | Videos.removeAllRemotesOf(urls, function (err, r) { |
191 | if (err) { | 191 | if (err) { |
192 | logger.error('Cannot remove videos from a pod that we removing.', { error: err }) | 192 | logger.error('Cannot remove videos from a pod that we removing.', { error: err }) |
193 | } else { | 193 | } else { |
194 | var videos_removed = r.result.n | 194 | const videos_removed = r.result.n |
195 | logger.info('Removed %d videos.', videos_removed) | 195 | logger.info('Removed %d videos.', videos_removed) |
196 | } | 196 | } |
197 | 197 | ||
@@ -199,7 +199,7 @@ function removeBadPods () { | |||
199 | if (err) { | 199 | if (err) { |
200 | logger.error('Cannot remove bad pods.', { error: err }) | 200 | logger.error('Cannot remove bad pods.', { error: err }) |
201 | } else { | 201 | } else { |
202 | var pods_removed = r.result.n | 202 | const pods_removed = r.result.n |
203 | logger.info('Removed %d pods.', pods_removed) | 203 | logger.info('Removed %d pods.', pods_removed) |
204 | } | 204 | } |
205 | }) | 205 | }) |