aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/friends.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/friends.js')
-rw-r--r--server/lib/friends.js31
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')
19const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS] 19const ENDPOINT_ACTIONS = constants.REQUEST_ENDPOINT_ACTIONS[constants.REQUEST_ENDPOINTS.VIDEOS]
20 20
21const requestScheduler = new RequestScheduler() 21const requestScheduler = new RequestScheduler()
22const requestSchedulerVideoQadu = new RequestVideoQaduScheduler() 22const requestVideoQaduScheduler = new RequestVideoQaduScheduler()
23const requestSchedulerVideoEvent = new RequestVideoEventScheduler() 23const requestVideoEventScheduler = new RequestVideoEventScheduler()
24 24
25const friends = { 25const 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
39function activate () { 42function activate () {
40 requestScheduler.activate() 43 requestScheduler.activate()
41 requestSchedulerVideoQadu.activate() 44 requestVideoQaduScheduler.activate()
42 requestSchedulerVideoEvent.activate() 45 requestVideoEventScheduler.activate()
43} 46}
44 47
45function addVideoToFriends (videoData, transaction, callback) { 48function 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
221function getRequestScheduler () {
222 return requestScheduler
223}
224
225function getRequestVideoQaduScheduler () {
226 return requestVideoQaduScheduler
227}
228
229function getRequestVideoEventScheduler () {
230 return requestVideoEventScheduler
231}
232
218// --------------------------------------------------------------------------- 233// ---------------------------------------------------------------------------
219 234
220module.exports = friends 235module.exports = friends
@@ -345,13 +360,13 @@ function createRequest (options, callback) {
345function createVideoQaduRequest (options, callback) { 360function 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
351function createVideoEventRequest (options, callback) { 366function 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
357function isMe (host) { 372function isMe (host) {