aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/friends.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-12 11:56:02 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-12 11:56:02 +0200
commitf981dae8617271a2dc713bb683951730b306e0c5 (patch)
treeecee631766bc1b98c20a7836479fed40850c5a56 /server/lib/friends.ts
parent075f16caac5236cb04c98ae7b3a989766d764bb3 (diff)
downloadPeerTube-f981dae8617271a2dc713bb683951730b306e0c5.tar.gz
PeerTube-f981dae8617271a2dc713bb683951730b306e0c5.tar.zst
PeerTube-f981dae8617271a2dc713bb683951730b306e0c5.zip
Add previews cache system between pods
Diffstat (limited to 'server/lib/friends.ts')
-rw-r--r--server/lib/friends.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/server/lib/friends.ts b/server/lib/friends.ts
index 6ed0da013..50355d5d1 100644
--- a/server/lib/friends.ts
+++ b/server/lib/friends.ts
@@ -1,6 +1,7 @@
1import * as request from 'request' 1import * as request from 'request'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3import * as Promise from 'bluebird' 3import * as Promise from 'bluebird'
4import { join } from 'path'
4 5
5import { database as db } from '../initializers/database' 6import { database as db } from '../initializers/database'
6import { 7import {
@@ -9,7 +10,8 @@ import {
9 REQUESTS_IN_PARALLEL, 10 REQUESTS_IN_PARALLEL,
10 REQUEST_ENDPOINTS, 11 REQUEST_ENDPOINTS,
11 REQUEST_ENDPOINT_ACTIONS, 12 REQUEST_ENDPOINT_ACTIONS,
12 REMOTE_SCHEME 13 REMOTE_SCHEME,
14 STATIC_PATHS
13} from '../initializers' 15} from '../initializers'
14import { 16import {
15 logger, 17 logger,
@@ -233,6 +235,13 @@ function sendOwnedVideosToPod (podId: number) {
233 }) 235 })
234} 236}
235 237
238function fetchRemotePreview (pod: PodInstance, video: VideoInstance) {
239 const host = video.Author.Pod.host
240 const path = join(STATIC_PATHS.PREVIEWS, video.getPreviewName())
241
242 return request.get(REMOTE_SCHEME.HTTP + '://' + host + path)
243}
244
236function getRequestScheduler () { 245function getRequestScheduler () {
237 return requestScheduler 246 return requestScheduler
238} 247}
@@ -263,7 +272,8 @@ export {
263 sendOwnedVideosToPod, 272 sendOwnedVideosToPod,
264 getRequestScheduler, 273 getRequestScheduler,
265 getRequestVideoQaduScheduler, 274 getRequestVideoQaduScheduler,
266 getRequestVideoEventScheduler 275 getRequestVideoEventScheduler,
276 fetchRemotePreview
267} 277}
268 278
269// --------------------------------------------------------------------------- 279// ---------------------------------------------------------------------------