diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-02 17:25:05 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-02 17:25:05 +0200 |
commit | e3647ae226d19ed1401d4c617d35a68de1c4657a (patch) | |
tree | 725380f4123702dfc19d208d8cf90be10a7c2b32 /server/lib/friends.js | |
parent | a6e7400f6470a657059225807cc2853144088dbc (diff) | |
download | PeerTube-e3647ae226d19ed1401d4c617d35a68de1c4657a.tar.gz PeerTube-e3647ae226d19ed1401d4c617d35a68de1c4657a.tar.zst PeerTube-e3647ae226d19ed1401d4c617d35a68de1c4657a.zip |
Rename pool requests --> requests scheduler
Diffstat (limited to 'server/lib/friends.js')
-rw-r--r-- | server/lib/friends.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/friends.js b/server/lib/friends.js index c3c231604..9a2c5c06e 100644 --- a/server/lib/friends.js +++ b/server/lib/friends.js | |||
@@ -9,7 +9,7 @@ const constants = require('../initializers/constants') | |||
9 | const logger = require('../helpers/logger') | 9 | const logger = require('../helpers/logger') |
10 | const peertubeCrypto = require('../helpers/peertubeCrypto') | 10 | const peertubeCrypto = require('../helpers/peertubeCrypto') |
11 | const Pods = require('../models/pods') | 11 | const Pods = require('../models/pods') |
12 | const poolRequests = require('../lib/poolRequests') | 12 | const requestsScheduler = require('../lib/requestsScheduler') |
13 | const requests = require('../helpers/requests') | 13 | const requests = require('../helpers/requests') |
14 | const Videos = require('../models/videos') | 14 | const Videos = require('../models/videos') |
15 | 15 | ||
@@ -30,7 +30,7 @@ function addVideoToFriends (video) { | |||
30 | const id = video.name + video.magnetUri | 30 | const id = video.name + video.magnetUri |
31 | // ensure namePath is null | 31 | // ensure namePath is null |
32 | video.namePath = null | 32 | video.namePath = null |
33 | poolRequests.addRequest(id, 'add', video) | 33 | requestsScheduler.addRequest(id, 'add', video) |
34 | } | 34 | } |
35 | 35 | ||
36 | function hasFriends (callback) { | 36 | function hasFriends (callback) { |
@@ -70,9 +70,9 @@ function makeFriends (callback) { | |||
70 | 70 | ||
71 | function quitFriends (callback) { | 71 | function quitFriends (callback) { |
72 | // Stop pool requests | 72 | // Stop pool requests |
73 | poolRequests.deactivate() | 73 | requestsScheduler.deactivate() |
74 | // Flush pool requests | 74 | // Flush pool requests |
75 | poolRequests.forceSend() | 75 | requestsScheduler.forceSend() |
76 | 76 | ||
77 | Pods.list(function (err, pods) { | 77 | Pods.list(function (err, pods) { |
78 | if (err) return callback(err) | 78 | if (err) return callback(err) |
@@ -90,7 +90,7 @@ function quitFriends (callback) { | |||
90 | // Announce we quit them | 90 | // Announce we quit them |
91 | requests.makeMultipleRetryRequest(request, pods, function () { | 91 | requests.makeMultipleRetryRequest(request, pods, function () { |
92 | Pods.removeAll(function (err) { | 92 | Pods.removeAll(function (err) { |
93 | poolRequests.activate() | 93 | requestsScheduler.activate() |
94 | 94 | ||
95 | if (err) return callback(err) | 95 | if (err) return callback(err) |
96 | 96 | ||
@@ -110,7 +110,7 @@ function quitFriends (callback) { | |||
110 | function removeVideoToFriends (video) { | 110 | function removeVideoToFriends (video) { |
111 | // To avoid duplicates | 111 | // To avoid duplicates |
112 | const id = video.name + video.magnetUri | 112 | const id = video.name + video.magnetUri |
113 | poolRequests.addRequest(id, 'remove', video) | 113 | requestsScheduler.addRequest(id, 'remove', video) |
114 | } | 114 | } |
115 | 115 | ||
116 | // --------------------------------------------------------------------------- | 116 | // --------------------------------------------------------------------------- |
@@ -164,9 +164,9 @@ function getForeignPodsList (url, callback) { | |||
164 | 164 | ||
165 | function makeRequestsToWinningPods (cert, pods_list, callback) { | 165 | function makeRequestsToWinningPods (cert, pods_list, callback) { |
166 | // Stop pool requests | 166 | // Stop pool requests |
167 | poolRequests.deactivate() | 167 | requestsScheduler.deactivate() |
168 | // Flush pool requests | 168 | // Flush pool requests |
169 | poolRequests.forceSend() | 169 | requestsScheduler.forceSend() |
170 | 170 | ||
171 | // Get the list of our videos to send to our new friends | 171 | // Get the list of our videos to send to our new friends |
172 | Videos.listOwned(function (err, videos_list) { | 172 | Videos.listOwned(function (err, videos_list) { |
@@ -213,7 +213,7 @@ function makeRequestsToWinningPods (cert, pods_list, callback) { | |||
213 | 213 | ||
214 | function endRequests (err) { | 214 | function endRequests (err) { |
215 | // Now we made new friends, we can re activate the pool of requests | 215 | // Now we made new friends, we can re activate the pool of requests |
216 | poolRequests.activate() | 216 | requestsScheduler.activate() |
217 | 217 | ||
218 | if (err) { | 218 | if (err) { |
219 | logger.error('There was some errors when we wanted to make friends.') | 219 | logger.error('There was some errors when we wanted to make friends.') |