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 | |
parent | 4f133041819409a72cf70fa2fa6c4df14c6de4fd (diff) | |
download | PeerTube-e636eb88101a51399057c86477af6677f5614d48.tar.gz PeerTube-e636eb88101a51399057c86477af6677f5614d48.tar.zst PeerTube-e636eb88101a51399057c86477af6677f5614d48.zip |
Requests -> RequestSchedulers
25 files changed, 62 insertions, 67 deletions
diff --git a/client/src/app/+admin/admin-routing.module.ts b/client/src/app/+admin/admin-routing.module.ts index 839913135..bcc94a9f3 100644 --- a/client/src/app/+admin/admin-routing.module.ts +++ b/client/src/app/+admin/admin-routing.module.ts | |||
@@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router' | |||
3 | 3 | ||
4 | import { AdminComponent } from './admin.component' | 4 | import { AdminComponent } from './admin.component' |
5 | import { FriendsRoutes } from './friends' | 5 | import { FriendsRoutes } from './friends' |
6 | import { RequestsRoutes } from './requests' | 6 | import { RequestSchedulersRoutes } from './request-schedulers' |
7 | import { UsersRoutes } from './users' | 7 | import { UsersRoutes } from './users' |
8 | import { VideoAbusesRoutes } from './video-abuses' | 8 | import { VideoAbusesRoutes } from './video-abuses' |
9 | 9 | ||
@@ -18,7 +18,7 @@ const adminRoutes: Routes = [ | |||
18 | pathMatch: 'full' | 18 | pathMatch: 'full' |
19 | }, | 19 | }, |
20 | ...FriendsRoutes, | 20 | ...FriendsRoutes, |
21 | ...RequestsRoutes, | 21 | ...RequestSchedulersRoutes, |
22 | ...UsersRoutes, | 22 | ...UsersRoutes, |
23 | ...VideoAbusesRoutes | 23 | ...VideoAbusesRoutes |
24 | ] | 24 | ] |
diff --git a/client/src/app/+admin/admin.module.ts b/client/src/app/+admin/admin.module.ts index 9ecce5dc3..e4ba8e5b7 100644 --- a/client/src/app/+admin/admin.module.ts +++ b/client/src/app/+admin/admin.module.ts | |||
@@ -3,7 +3,7 @@ import { NgModule } from '@angular/core' | |||
3 | import { AdminComponent } from './admin.component' | 3 | import { AdminComponent } from './admin.component' |
4 | import { AdminRoutingModule } from './admin-routing.module' | 4 | import { AdminRoutingModule } from './admin-routing.module' |
5 | import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends' | 5 | import { FriendsComponent, FriendAddComponent, FriendListComponent, FriendService } from './friends' |
6 | import { RequestsComponent, RequestStatsComponent, RequestService } from './requests' | 6 | import { RequestSchedulersComponent, RequestSchedulersStatsComponent, RequestSchedulersService } from './request-schedulers' |
7 | import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users' | 7 | import { UsersComponent, UserAddComponent, UserListComponent, UserService } from './users' |
8 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' | 8 | import { VideoAbusesComponent, VideoAbuseListComponent } from './video-abuses' |
9 | import { SharedModule } from '../shared' | 9 | import { SharedModule } from '../shared' |
@@ -21,8 +21,8 @@ import { SharedModule } from '../shared' | |||
21 | FriendAddComponent, | 21 | FriendAddComponent, |
22 | FriendListComponent, | 22 | FriendListComponent, |
23 | 23 | ||
24 | RequestsComponent, | 24 | RequestSchedulersComponent, |
25 | RequestStatsComponent, | 25 | RequestSchedulersStatsComponent, |
26 | 26 | ||
27 | UsersComponent, | 27 | UsersComponent, |
28 | UserAddComponent, | 28 | UserAddComponent, |
@@ -38,7 +38,7 @@ import { SharedModule } from '../shared' | |||
38 | 38 | ||
39 | providers: [ | 39 | providers: [ |
40 | FriendService, | 40 | FriendService, |
41 | RequestService, | 41 | RequestSchedulersService, |
42 | UserService | 42 | UserService |
43 | ] | 43 | ] |
44 | }) | 44 | }) |
diff --git a/client/src/app/+admin/index.ts b/client/src/app/+admin/index.ts index 11e2587c0..b628a3662 100644 --- a/client/src/app/+admin/index.ts +++ b/client/src/app/+admin/index.ts | |||
@@ -1,6 +1 @@ | |||
1 | export * from './friends' | ||
2 | export * from './requests' | ||
3 | export * from './users' | ||
4 | export * from './admin-routing.module' | ||
5 | export * from './admin.module' | export * from './admin.module' | |
6 | export * from './admin.component' | ||
diff --git a/client/src/app/+admin/request-schedulers/index.ts b/client/src/app/+admin/request-schedulers/index.ts new file mode 100644 index 000000000..87b72e8c7 --- /dev/null +++ b/client/src/app/+admin/request-schedulers/index.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export * from './request-schedulers-stats' | ||
2 | export * from './shared' | ||
3 | export * from './request-schedulers.component' | ||
4 | export * from './request-schedulers.routes' | ||
diff --git a/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts b/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts new file mode 100644 index 000000000..a3323e6be --- /dev/null +++ b/client/src/app/+admin/request-schedulers/request-schedulers-stats/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './request-schedulers-stats.component' | |||
diff --git a/client/src/app/+admin/requests/request-stats/request-stats.component.html b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.html index 4508ab4c2..4508ab4c2 100644 --- a/client/src/app/+admin/requests/request-stats/request-stats.component.html +++ b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.html | |||
diff --git a/client/src/app/+admin/requests/request-stats/request-stats.component.scss b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.scss index b2c413259..b2c413259 100644 --- a/client/src/app/+admin/requests/request-stats/request-stats.component.scss +++ b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.scss | |||
diff --git a/client/src/app/+admin/requests/request-stats/request-stats.component.ts b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts index 140aaf47e..4e3fabc64 100644 --- a/client/src/app/+admin/requests/request-stats/request-stats.component.ts +++ b/client/src/app/+admin/request-schedulers/request-schedulers-stats/request-schedulers-stats.component.ts | |||
@@ -2,22 +2,22 @@ import { Component, OnInit, OnDestroy } from '@angular/core' | |||
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | 4 | ||
5 | import { RequestService, RequestSchedulerStatsAttributes } from '../shared' | 5 | import { RequestSchedulersService, RequestSchedulerStatsAttributes } from '../shared' |
6 | import { RequestScheduler } from '../../../../../../shared' | 6 | import { RequestSchedulerStats } from '../../../../../../shared' |
7 | 7 | ||
8 | @Component({ | 8 | @Component({ |
9 | selector: 'my-request-stats', | 9 | selector: 'my-request-schedulers-stats', |
10 | templateUrl: './request-stats.component.html', | 10 | templateUrl: './request-schedulers-stats.component.html', |
11 | styleUrls: [ './request-stats.component.scss' ] | 11 | styleUrls: [ './request-schedulers-stats.component.scss' ] |
12 | }) | 12 | }) |
13 | export class RequestStatsComponent implements OnInit, OnDestroy { | 13 | export class RequestSchedulersStatsComponent implements OnInit, OnDestroy { |
14 | statsTitles = { | 14 | statsTitles = { |
15 | requestScheduler: 'Basic request scheduler', | 15 | requestScheduler: 'Basic request scheduler', |
16 | requestVideoEventScheduler: 'Video events request scheduler', | 16 | requestVideoEventScheduler: 'Video events request scheduler', |
17 | requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler' | 17 | requestVideoQaduScheduler: 'Quick and dirty video updates request scheduler' |
18 | } | 18 | } |
19 | 19 | ||
20 | stats: RequestScheduler | 20 | stats: RequestSchedulerStats |
21 | 21 | ||
22 | private intervals: { [ id: string ]: number } = { | 22 | private intervals: { [ id: string ]: number } = { |
23 | requestScheduler: null, | 23 | requestScheduler: null, |
@@ -33,7 +33,7 @@ export class RequestStatsComponent implements OnInit, OnDestroy { | |||
33 | 33 | ||
34 | constructor ( | 34 | constructor ( |
35 | private notificationsService: NotificationsService, | 35 | private notificationsService: NotificationsService, |
36 | private requestService: RequestService | 36 | private requestService: RequestSchedulersService |
37 | ) { } | 37 | ) { } |
38 | 38 | ||
39 | ngOnInit () { | 39 | ngOnInit () { |
diff --git a/client/src/app/+admin/requests/requests.component.ts b/client/src/app/+admin/request-schedulers/request-schedulers.component.ts index 88a90fa4e..5444d6ea5 100644 --- a/client/src/app/+admin/requests/requests.component.ts +++ b/client/src/app/+admin/request-schedulers/request-schedulers.component.ts | |||
@@ -3,5 +3,5 @@ import { Component } from '@angular/core' | |||
3 | @Component({ | 3 | @Component({ |
4 | template: '<router-outlet></router-outlet>' | 4 | template: '<router-outlet></router-outlet>' |
5 | }) | 5 | }) |
6 | export class RequestsComponent { | 6 | export class RequestSchedulersComponent { |
7 | } | 7 | } |
diff --git a/client/src/app/+admin/requests/requests.routes.ts b/client/src/app/+admin/request-schedulers/request-schedulers.routes.ts index 84db3fea8..4961c646b 100644 --- a/client/src/app/+admin/requests/requests.routes.ts +++ b/client/src/app/+admin/request-schedulers/request-schedulers.routes.ts | |||
@@ -1,12 +1,12 @@ | |||
1 | import { Routes } from '@angular/router' | 1 | import { Routes } from '@angular/router' |
2 | 2 | ||
3 | import { RequestsComponent } from './requests.component' | 3 | import { RequestSchedulersComponent } from './request-schedulers.component' |
4 | import { RequestStatsComponent } from './request-stats' | 4 | import { RequestSchedulersStatsComponent } from './request-schedulers-stats' |
5 | 5 | ||
6 | export const RequestsRoutes: Routes = [ | 6 | export const RequestSchedulersRoutes: Routes = [ |
7 | { | 7 | { |
8 | path: 'requests', | 8 | path: 'requests', |
9 | component: RequestsComponent, | 9 | component: RequestSchedulersComponent, |
10 | children: [ | 10 | children: [ |
11 | { | 11 | { |
12 | path: '', | 12 | path: '', |
@@ -15,7 +15,7 @@ export const RequestsRoutes: Routes = [ | |||
15 | }, | 15 | }, |
16 | { | 16 | { |
17 | path: 'stats', | 17 | path: 'stats', |
18 | component: RequestStatsComponent, | 18 | component: RequestSchedulersStatsComponent, |
19 | data: { | 19 | data: { |
20 | meta: { | 20 | meta: { |
21 | title: 'Request stats' | 21 | title: 'Request stats' |
diff --git a/client/src/app/+admin/request-schedulers/shared/index.ts b/client/src/app/+admin/request-schedulers/shared/index.ts new file mode 100644 index 000000000..1a0174409 --- /dev/null +++ b/client/src/app/+admin/request-schedulers/shared/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './request-schedulers-stats-attributes.model' | ||
2 | export * from './request-schedulers.service' | ||
diff --git a/client/src/app/+admin/requests/shared/request-stats-attributes.model.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts index 394acc73d..6e19a0e44 100644 --- a/client/src/app/+admin/requests/shared/request-stats-attributes.model.ts +++ b/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import { RequestSchedulerAttributes as FormatedRequestSchedulerAttributes } from '../../../../../../shared' | 1 | import { RequestSchedulerStatsAttributes as FormatedRequestSchedulerStatsAttributes } from '../../../../../../shared' |
2 | 2 | ||
3 | export interface Request { | 3 | export interface Request { |
4 | request: any | 4 | request: any |
5 | to: any | 5 | to: any |
6 | } | 6 | } |
7 | 7 | ||
8 | export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerAttributes { | 8 | export class RequestSchedulerStatsAttributes implements FormatedRequestSchedulerStatsAttributes { |
9 | requestsLimitPods: number | 9 | requestsLimitPods: number |
10 | requestsLimitPerPod: number | 10 | requestsLimitPerPod: number |
11 | milliSecondsInterval: number | 11 | milliSecondsInterval: number |
diff --git a/client/src/app/+admin/requests/shared/request.service.ts b/client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts index 53682b111..e9b166f78 100644 --- a/client/src/app/+admin/requests/shared/request.service.ts +++ b/client/src/app/+admin/request-schedulers/shared/request-schedulers.service.ts | |||
@@ -3,27 +3,27 @@ import { Observable } from 'rxjs/Observable' | |||
3 | import 'rxjs/add/operator/catch' | 3 | import 'rxjs/add/operator/catch' |
4 | import 'rxjs/add/operator/map' | 4 | import 'rxjs/add/operator/map' |
5 | 5 | ||
6 | import { RequestScheduler } from '../../../../../../shared' | 6 | import { RequestSchedulerStats } from '../../../../../../shared' |
7 | import { AuthHttp, RestExtractor } from '../../../shared' | 7 | import { AuthHttp, RestExtractor } from '../../../shared' |
8 | import { RequestSchedulerStatsAttributes } from './request-stats-attributes.model' | 8 | import { RequestSchedulerStatsAttributes } from './request-schedulers-stats-attributes.model' |
9 | 9 | ||
10 | @Injectable() | 10 | @Injectable() |
11 | export class RequestService { | 11 | export class RequestSchedulersService { |
12 | private static BASE_REQUEST_URL = API_URL + '/api/v1/requests/' | 12 | private static BASE_REQUEST_URL = API_URL + '/api/v1/request-schedulers/' |
13 | 13 | ||
14 | constructor ( | 14 | constructor ( |
15 | private authHttp: AuthHttp, | 15 | private authHttp: AuthHttp, |
16 | private restExtractor: RestExtractor | 16 | private restExtractor: RestExtractor |
17 | ) {} | 17 | ) {} |
18 | 18 | ||
19 | getStats (): Observable<RequestScheduler> { | 19 | getStats (): Observable<RequestSchedulerStats> { |
20 | return this.authHttp.get(RequestService.BASE_REQUEST_URL + 'stats') | 20 | return this.authHttp.get(RequestSchedulersService.BASE_REQUEST_URL + 'stats') |
21 | .map(this.restExtractor.extractDataGet) | 21 | .map(this.restExtractor.extractDataGet) |
22 | .map(this.buildRequestObjects) | 22 | .map(this.buildRequestObjects) |
23 | .catch((res) => this.restExtractor.handleError(res)) | 23 | .catch((res) => this.restExtractor.handleError(res)) |
24 | } | 24 | } |
25 | 25 | ||
26 | private buildRequestObjects (data: RequestScheduler) { | 26 | private buildRequestObjects (data: RequestSchedulerStats) { |
27 | const requestSchedulers = {} | 27 | const requestSchedulers = {} |
28 | 28 | ||
29 | Object.keys(data).forEach(requestSchedulerName => { | 29 | Object.keys(data).forEach(requestSchedulerName => { |
diff --git a/client/src/app/+admin/requests/index.ts b/client/src/app/+admin/requests/index.ts deleted file mode 100644 index d96a893c3..000000000 --- a/client/src/app/+admin/requests/index.ts +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | export * from './request-stats' | ||
2 | export * from './shared' | ||
3 | export * from './requests.component' | ||
4 | export * from './requests.routes' | ||
diff --git a/client/src/app/+admin/requests/request-stats/index.ts b/client/src/app/+admin/requests/request-stats/index.ts deleted file mode 100644 index 740c401bb..000000000 --- a/client/src/app/+admin/requests/request-stats/index.ts +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | export * from './request-stats.component' | ||
diff --git a/client/src/app/+admin/requests/shared/index.ts b/client/src/app/+admin/requests/shared/index.ts deleted file mode 100644 index 857fe9d29..000000000 --- a/client/src/app/+admin/requests/shared/index.ts +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | export * from './request-stats-attributes.model' | ||
2 | export * from './request.service' | ||
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 | |||
diff --git a/shared/models/request-scheduler.model.ts b/shared/models/request-scheduler.model.ts index f94ccfcab..8df184a09 100644 --- a/shared/models/request-scheduler.model.ts +++ b/shared/models/request-scheduler.model.ts | |||
@@ -4,7 +4,7 @@ export type RequestVideoQaduType = 'likes' | 'dislikes' | 'views' | |||
4 | 4 | ||
5 | export type RequestVideoEventType = 'likes' | 'dislikes' | 'views' | 5 | export type RequestVideoEventType = 'likes' | 'dislikes' | 'views' |
6 | 6 | ||
7 | export type RequestSchedulerAttributes = { | 7 | export type RequestSchedulerStatsAttributes = { |
8 | totalRequests: number | 8 | totalRequests: number |
9 | requestsLimitPods: number | 9 | requestsLimitPods: number |
10 | requestsLimitPerPod: number | 10 | requestsLimitPerPod: number |
@@ -12,8 +12,8 @@ export type RequestSchedulerAttributes = { | |||
12 | milliSecondsInterval: number | 12 | milliSecondsInterval: number |
13 | } | 13 | } |
14 | 14 | ||
15 | export interface RequestScheduler { | 15 | export interface RequestSchedulerStats { |
16 | requestScheduler: RequestSchedulerAttributes | 16 | requestScheduler: RequestSchedulerStatsAttributes |
17 | requestVideoQaduScheduler: RequestSchedulerAttributes | 17 | requestVideoQaduScheduler: RequestSchedulerStatsAttributes |
18 | requestVideoEventScheduler: RequestSchedulerAttributes | 18 | requestVideoEventScheduler: RequestSchedulerStatsAttributes |
19 | } | 19 | } |