diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-02-27 21:56:55 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-02-27 21:56:55 +0100 |
commit | 99fdec464802e5d720fe08ead06b63368b115baf (patch) | |
tree | d3129ec4e37894036fc8e83ee17a953873f41e12 /server/lib/friends.js | |
parent | 05a9feaa48cea560abd9561434a3479ab1021643 (diff) | |
download | PeerTube-99fdec464802e5d720fe08ead06b63368b115baf.tar.gz PeerTube-99fdec464802e5d720fe08ead06b63368b115baf.tar.zst PeerTube-99fdec464802e5d720fe08ead06b63368b115baf.zip |
Fix request schedulers stats
Diffstat (limited to 'server/lib/friends.js')
-rw-r--r-- | server/lib/friends.js | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/server/lib/friends.js b/server/lib/friends.js index 203f0e52c..7bd087d8c 100644 --- a/server/lib/friends.js +++ b/server/lib/friends.js | |||
@@ -19,8 +19,8 @@ const RequestVideoEventScheduler = require('./request-video-event-scheduler') | |||
19 | const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS] | 19 | const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS] |
20 | 20 | ||
21 | const requestScheduler = new RequestScheduler() | 21 | const requestScheduler = new RequestScheduler() |
22 | const requestSchedulerVideoQadu = new RequestVideoQaduScheduler() | 22 | const requestVideoQaduScheduler = new RequestVideoQaduScheduler() |
23 | const requestSchedulerVideoEvent = new RequestVideoEventScheduler() | 23 | const requestVideoEventScheduler = new RequestVideoEventScheduler() |
24 | 24 | ||
25 | const friends = { | 25 | const friends = { |
26 | activate, | 26 | activate, |
@@ -33,13 +33,16 @@ const friends = { | |||
33 | makeFriends, | 33 | makeFriends, |
34 | quitFriends, | 34 | quitFriends, |
35 | removeVideoToFriends, | 35 | removeVideoToFriends, |
36 | sendOwnedVideosToPod | 36 | sendOwnedVideosToPod, |
37 | getRequestScheduler, | ||
38 | getRequestVideoQaduScheduler, | ||
39 | getRequestVideoEventScheduler | ||
37 | } | 40 | } |
38 | 41 | ||
39 | function activate () { | 42 | function activate () { |
40 | requestScheduler.activate() | 43 | requestScheduler.activate() |
41 | requestSchedulerVideoQadu.activate() | 44 | requestVideoQaduScheduler.activate() |
42 | requestSchedulerVideoEvent.activate() | 45 | requestVideoEventScheduler.activate() |
43 | } | 46 | } |
44 | 47 | ||
45 | function addVideoToFriends (videoData, transaction, callback) { | 48 | function addVideoToFriends (videoData, transaction, callback) { |
@@ -142,7 +145,7 @@ function quitFriends (callback) { | |||
142 | }, | 145 | }, |
143 | 146 | ||
144 | function flushVideoQaduRequests (callbackAsync) { | 147 | function flushVideoQaduRequests (callbackAsync) { |
145 | requestSchedulerVideoQadu.flush(err => callbackAsync(err)) | 148 | requestVideoQaduScheduler.flush(err => callbackAsync(err)) |
146 | }, | 149 | }, |
147 | 150 | ||
148 | function getPodsList (callbackAsync) { | 151 | function getPodsList (callbackAsync) { |
@@ -215,6 +218,18 @@ function sendOwnedVideosToPod (podId) { | |||
215 | }) | 218 | }) |
216 | } | 219 | } |
217 | 220 | ||
221 | function getRequestScheduler () { | ||
222 | return requestScheduler | ||
223 | } | ||
224 | |||
225 | function getRequestVideoQaduScheduler () { | ||
226 | return requestVideoQaduScheduler | ||
227 | } | ||
228 | |||
229 | function getRequestVideoEventScheduler () { | ||
230 | return requestVideoEventScheduler | ||
231 | } | ||
232 | |||
218 | // --------------------------------------------------------------------------- | 233 | // --------------------------------------------------------------------------- |
219 | 234 | ||
220 | module.exports = friends | 235 | module.exports = friends |
@@ -345,13 +360,13 @@ function createRequest (options, callback) { | |||
345 | function createVideoQaduRequest (options, callback) { | 360 | function createVideoQaduRequest (options, callback) { |
346 | if (!callback) callback = utils.createEmptyCallback() | 361 | if (!callback) callback = utils.createEmptyCallback() |
347 | 362 | ||
348 | requestSchedulerVideoQadu.createRequest(options, callback) | 363 | requestVideoQaduScheduler.createRequest(options, callback) |
349 | } | 364 | } |
350 | 365 | ||
351 | function createVideoEventRequest (options, callback) { | 366 | function createVideoEventRequest (options, callback) { |
352 | if (!callback) callback = utils.createEmptyCallback() | 367 | if (!callback) callback = utils.createEmptyCallback() |
353 | 368 | ||
354 | requestSchedulerVideoEvent.createRequest(options, callback) | 369 | requestVideoEventScheduler.createRequest(options, callback) |
355 | } | 370 | } |
356 | 371 | ||
357 | function isMe (host) { | 372 | function isMe (host) { |