diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-25 17:19:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-25 17:19:46 +0200 |
commit | e636eb88101a51399057c86477af6677f5614d48 (patch) | |
tree | ba56f0da932613c8013a2c52905ded1987cd6d6d /server | |
parent | 4f133041819409a72cf70fa2fa6c4df14c6de4fd (diff) | |
download | PeerTube-e636eb88101a51399057c86477af6677f5614d48.tar.gz PeerTube-e636eb88101a51399057c86477af6677f5614d48.tar.zst PeerTube-e636eb88101a51399057c86477af6677f5614d48.zip |
Requests -> RequestSchedulers
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/index.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/request-schedulers.ts (renamed from server/controllers/api/requests.ts) | 22 | ||||
-rw-r--r-- | server/tests/api/check-params/index.js | 2 | ||||
-rw-r--r-- | server/tests/api/check-params/request-schedulers.js (renamed from server/tests/api/check-params/requests.js) | 4 | ||||
-rw-r--r-- | server/tests/api/index.js | 2 | ||||
-rw-r--r-- | server/tests/api/request-schedulers.js (renamed from server/tests/api/requests.js) | 4 | ||||
-rw-r--r-- | server/tests/real-world/real-world.js | 4 | ||||
-rw-r--r-- | server/tests/utils/request-schedulers.js (renamed from server/tests/utils/requests-stats.js) | 0 |
8 files changed, 21 insertions, 21 deletions
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index ac3972ac6..3abe9bcf8 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts | |||
@@ -6,7 +6,7 @@ import { clientsRouter } from './clients' | |||
6 | import { configRouter } from './config' | 6 | import { configRouter } from './config' |
7 | import { podsRouter } from './pods' | 7 | import { podsRouter } from './pods' |
8 | import { remoteRouter } from './remote' | 8 | import { remoteRouter } from './remote' |
9 | import { requestsRouter } from './requests' | 9 | import { requestSchedulerRouter } from './request-schedulers' |
10 | import { usersRouter } from './users' | 10 | import { usersRouter } from './users' |
11 | import { videosRouter } from './videos' | 11 | import { videosRouter } from './videos' |
12 | 12 | ||
@@ -16,7 +16,7 @@ apiRouter.use('/clients', clientsRouter) | |||
16 | apiRouter.use('/config', configRouter) | 16 | apiRouter.use('/config', configRouter) |
17 | apiRouter.use('/pods', podsRouter) | 17 | apiRouter.use('/pods', podsRouter) |
18 | apiRouter.use('/remote', remoteRouter) | 18 | apiRouter.use('/remote', remoteRouter) |
19 | apiRouter.use('/requests', requestsRouter) | 19 | apiRouter.use('/request-schedulers', requestSchedulerRouter) |
20 | apiRouter.use('/users', usersRouter) | 20 | apiRouter.use('/users', usersRouter) |
21 | apiRouter.use('/videos', videosRouter) | 21 | apiRouter.use('/videos', videosRouter) |
22 | apiRouter.use('/ping', pong) | 22 | apiRouter.use('/ping', pong) |
diff --git a/server/controllers/api/requests.ts b/server/controllers/api/request-schedulers.ts index 5718b59b7..8dd849007 100644 --- a/server/controllers/api/requests.ts +++ b/server/controllers/api/request-schedulers.ts | |||
@@ -8,29 +8,29 @@ import { | |||
8 | getRequestVideoEventScheduler | 8 | getRequestVideoEventScheduler |
9 | } from '../../lib' | 9 | } from '../../lib' |
10 | import { authenticate, ensureIsAdmin } from '../../middlewares' | 10 | import { authenticate, ensureIsAdmin } from '../../middlewares' |
11 | import { RequestSchedulerAttributes } from '../../../shared' | 11 | import { RequestSchedulerStatsAttributes } from '../../../shared' |
12 | 12 | ||
13 | const requestsRouter = express.Router() | 13 | const requestSchedulerRouter = express.Router() |
14 | 14 | ||
15 | requestsRouter.get('/stats', | 15 | requestSchedulerRouter.get('/stats', |
16 | authenticate, | 16 | authenticate, |
17 | ensureIsAdmin, | 17 | ensureIsAdmin, |
18 | getStatsRequests | 18 | getRequestSchedulersStats |
19 | ) | 19 | ) |
20 | 20 | ||
21 | // --------------------------------------------------------------------------- | 21 | // --------------------------------------------------------------------------- |
22 | 22 | ||
23 | export { | 23 | export { |
24 | requestsRouter | 24 | requestSchedulerRouter |
25 | } | 25 | } |
26 | 26 | ||
27 | // --------------------------------------------------------------------------- | 27 | // --------------------------------------------------------------------------- |
28 | 28 | ||
29 | function getStatsRequests (req: express.Request, res: express.Response, next: express.NextFunction) { | 29 | function getRequestSchedulersStats (req: express.Request, res: express.Response, next: express.NextFunction) { |
30 | parallel({ | 30 | parallel({ |
31 | requestScheduler: buildRequestSchedulerFunction(getRequestScheduler()), | 31 | requestScheduler: buildRequestSchedulerStats(getRequestScheduler()), |
32 | requestVideoQaduScheduler: buildRequestSchedulerFunction(getRequestVideoQaduScheduler()), | 32 | requestVideoQaduScheduler: buildRequestSchedulerStats(getRequestVideoQaduScheduler()), |
33 | requestVideoEventScheduler: buildRequestSchedulerFunction(getRequestVideoEventScheduler()) | 33 | requestVideoEventScheduler: buildRequestSchedulerStats(getRequestVideoEventScheduler()) |
34 | }, function (err, result) { | 34 | }, function (err, result) { |
35 | if (err) return next(err) | 35 | if (err) return next(err) |
36 | 36 | ||
@@ -40,12 +40,12 @@ function getStatsRequests (req: express.Request, res: express.Response, next: ex | |||
40 | 40 | ||
41 | // --------------------------------------------------------------------------- | 41 | // --------------------------------------------------------------------------- |
42 | 42 | ||
43 | function buildRequestSchedulerFunction (requestScheduler: AbstractRequestScheduler) { | 43 | function buildRequestSchedulerStats (requestScheduler: AbstractRequestScheduler) { |
44 | return function (callback) { | 44 | return function (callback) { |
45 | requestScheduler.remainingRequestsCount(function (err, count) { | 45 | requestScheduler.remainingRequestsCount(function (err, count) { |
46 | if (err) return callback(err) | 46 | if (err) return callback(err) |
47 | 47 | ||
48 | const result: RequestSchedulerAttributes = { | 48 | const result: RequestSchedulerStatsAttributes = { |
49 | totalRequests: count, | 49 | totalRequests: count, |
50 | requestsLimitPods: requestScheduler.limitPods, | 50 | requestsLimitPods: requestScheduler.limitPods, |
51 | requestsLimitPerPod: requestScheduler.limitPerPod, | 51 | requestsLimitPerPod: requestScheduler.limitPerPod, |
diff --git a/server/tests/api/check-params/index.js b/server/tests/api/check-params/index.js index 527ab65a9..1ba16ff32 100644 --- a/server/tests/api/check-params/index.js +++ b/server/tests/api/check-params/index.js | |||
@@ -4,7 +4,7 @@ | |||
4 | require('./pods') | 4 | require('./pods') |
5 | require('./remotes') | 5 | require('./remotes') |
6 | require('./users') | 6 | require('./users') |
7 | require('./requests') | 7 | require('./request-schedulers') |
8 | require('./videos') | 8 | require('./videos') |
9 | require('./video-abuses') | 9 | require('./video-abuses') |
10 | require('./video-blacklists') | 10 | require('./video-blacklists') |
diff --git a/server/tests/api/check-params/requests.js b/server/tests/api/check-params/request-schedulers.js index 0ce5582d6..9ba0df730 100644 --- a/server/tests/api/check-params/requests.js +++ b/server/tests/api/check-params/request-schedulers.js | |||
@@ -9,8 +9,8 @@ const loginUtils = require('../../utils/login') | |||
9 | const usersUtils = require('../../utils/users') | 9 | const usersUtils = require('../../utils/users') |
10 | const serversUtils = require('../../utils/servers') | 10 | const serversUtils = require('../../utils/servers') |
11 | 11 | ||
12 | describe('Test requests API validators', function () { | 12 | describe('Test request schedulers stats API validators', function () { |
13 | const path = '/api/v1/requests/stats' | 13 | const path = '/api/v1/request-schedulers/stats' |
14 | let server = null | 14 | let server = null |
15 | let userAccessToken = null | 15 | let userAccessToken = null |
16 | 16 | ||
diff --git a/server/tests/api/index.js b/server/tests/api/index.js index cc86a3d3b..7404d7d88 100644 --- a/server/tests/api/index.js +++ b/server/tests/api/index.js | |||
@@ -9,6 +9,6 @@ require('./single-pod') | |||
9 | require('./video-abuse') | 9 | require('./video-abuse') |
10 | require('./video-blacklist') | 10 | require('./video-blacklist') |
11 | require('./multiple-pods') | 11 | require('./multiple-pods') |
12 | require('./requests') | 12 | require('./request-schedulers') |
13 | require('./friends-advanced') | 13 | require('./friends-advanced') |
14 | require('./video-transcoder') | 14 | require('./video-transcoder') |
diff --git a/server/tests/api/requests.js b/server/tests/api/request-schedulers.js index 8762163af..c5c443f14 100644 --- a/server/tests/api/requests.js +++ b/server/tests/api/request-schedulers.js | |||
@@ -12,9 +12,9 @@ const podsUtils = require('../utils/pods') | |||
12 | const serversUtils = require('../utils/servers') | 12 | const serversUtils = require('../utils/servers') |
13 | const videosUtils = require('../utils/videos') | 13 | const videosUtils = require('../utils/videos') |
14 | 14 | ||
15 | describe('Test requests stats', function () { | 15 | describe('Test requests schedulers stats', function () { |
16 | const requestSchedulerNames = [ 'requestScheduler', 'requestVideoQaduScheduler', 'requestVideoEventScheduler' ] | 16 | const requestSchedulerNames = [ 'requestScheduler', 'requestVideoQaduScheduler', 'requestVideoEventScheduler' ] |
17 | const path = '/api/v1/requests/stats' | 17 | const path = '/api/v1/request-schedulers/stats' |
18 | let servers = [] | 18 | let servers = [] |
19 | 19 | ||
20 | function uploadVideo (server, callback) { | 20 | function uploadVideo (server, callback) { |
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js index 3ac13f053..ea189c5f2 100644 --- a/server/tests/real-world/real-world.js +++ b/server/tests/real-world/real-world.js | |||
@@ -13,7 +13,7 @@ const loginUtils = require('../utils/login') | |||
13 | const podsUtils = require('../utils/pods') | 13 | const podsUtils = require('../utils/pods') |
14 | const serversUtils = require('../utils/servers') | 14 | const serversUtils = require('../utils/servers') |
15 | const videosUtils = require('../utils/videos') | 15 | const videosUtils = require('../utils/videos') |
16 | const requestStatsUtils = require('../utils/requests-stats') | 16 | const requestSchedulersUtils = require('../utils/request-schedulers') |
17 | 17 | ||
18 | program | 18 | program |
19 | .option('-c, --create [weight]', 'Weight for creating videos') | 19 | .option('-c, --create [weight]', 'Weight for creating videos') |
@@ -344,7 +344,7 @@ function isThereAwaitingRequests (servers, callback) { | |||
344 | 344 | ||
345 | // Check is each server has awaiting requestq | 345 | // Check is each server has awaiting requestq |
346 | each(servers, function (server, callbackEach) { | 346 | each(servers, function (server, callbackEach) { |
347 | requestStatsUtils.getRequestsStats(server, server.accessToken, function (err, res) { | 347 | requestSchedulersUtils.getRequestsStats(server, server.accessToken, function (err, res) { |
348 | if (err) throw err | 348 | if (err) throw err |
349 | 349 | ||
350 | const stats = res.body | 350 | const stats = res.body |
diff --git a/server/tests/utils/requests-stats.js b/server/tests/utils/request-schedulers.js index 16835ce47..16835ce47 100644 --- a/server/tests/utils/requests-stats.js +++ b/server/tests/utils/request-schedulers.js | |||