aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/poolRequests.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-16 22:29:27 +0100
commitf0f5567b6918fc60c8cab15e13aec03a89a91dfb (patch)
tree99dfdb9fa8273c9cda1360fd3b6bfccc515bf8be /server/lib/poolRequests.js
parent5101105ef91bfe478f97546b78b321882da2079c (diff)
downloadPeerTube-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.js36
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
3var async = require('async') 3const async = require('async')
4var pluck = require('lodash-node/compat/collection/pluck') 4const pluck = require('lodash-node/compat/collection/pluck')
5 5
6var constants = require('../initializers/constants') 6const constants = require('../initializers/constants')
7var logger = require('../helpers/logger') 7const logger = require('../helpers/logger')
8var Pods = require('../models/pods') 8const Pods = require('../models/pods')
9var PoolRequests = require('../models/poolRequests') 9const PoolRequests = require('../models/poolRequests')
10var requests = require('../helpers/requests') 10const requests = require('../helpers/requests')
11var Videos = require('../models/videos') 11const Videos = require('../models/videos')
12 12
13var timer = null 13let timer = null
14 14
15var poolRequests = { 15const 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 })