diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2015-12-04 16:13:32 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2015-12-04 16:13:32 +0100 |
commit | 0b69752270f1ceea06a29872b3db23660a55d6d3 (patch) | |
tree | 42da726633f3e48f4fe592cfd2c1ca14346a159b /server.js | |
parent | af82cae07dc568e3cb10acd70113df56eb8b15a9 (diff) | |
download | PeerTube-0b69752270f1ceea06a29872b3db23660a55d6d3.tar.gz PeerTube-0b69752270f1ceea06a29872b3db23660a55d6d3.tar.zst PeerTube-0b69752270f1ceea06a29872b3db23660a55d6d3.zip |
Add a pool of requests instead of making a request at each action (add
video/remove video) for performance in big networks
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -35,7 +35,9 @@ | |||
35 | 35 | ||
36 | // ----------- PeerTube modules ----------- | 36 | // ----------- PeerTube modules ----------- |
37 | var config = require('config') | 37 | var config = require('config') |
38 | var customValidators = require('./src/customValidators') | ||
38 | var logger = require('./src/logger') | 39 | var logger = require('./src/logger') |
40 | var poolRequests = require('./src/poolRequests') | ||
39 | var routes = require('./routes') | 41 | var routes = require('./routes') |
40 | var videos = require('./src/videos') | 42 | var videos = require('./src/videos') |
41 | var webtorrent = require('./src/webTorrentNode') | 43 | var webtorrent = require('./src/webTorrentNode') |
@@ -56,7 +58,9 @@ | |||
56 | app.use(multer({ dest: uploads })) | 58 | app.use(multer({ dest: uploads })) |
57 | app.use(bodyParser.urlencoded({ extended: false })) | 59 | app.use(bodyParser.urlencoded({ extended: false })) |
58 | // Validate some params for the API | 60 | // Validate some params for the API |
59 | app.use(expressValidator()) | 61 | app.use(expressValidator({ |
62 | customValidators: customValidators | ||
63 | })) | ||
60 | 64 | ||
61 | // ----------- Views, routes and static files ----------- | 65 | // ----------- Views, routes and static files ----------- |
62 | 66 | ||
@@ -154,6 +158,9 @@ | |||
154 | 158 | ||
155 | // ----------- Make the server listening ----------- | 159 | // ----------- Make the server listening ----------- |
156 | server.listen(port, function () { | 160 | server.listen(port, function () { |
161 | // Activate the pool requests | ||
162 | poolRequests.activate() | ||
163 | |||
157 | videos.seedAll(function () { | 164 | videos.seedAll(function () { |
158 | logger.info('Seeded all the videos') | 165 | logger.info('Seeded all the videos') |
159 | logger.info('Server listening on port %d', port) | 166 | logger.info('Server listening on port %d', port) |