766e808360294f5ac84b9d379a3bafe7705412cc
[oweals/peertube.git] / client / src / app / admin / requests / shared / request-stats.model.ts
1 export interface Request {
2   request: any;
3   to: any;
4 }
5
6 export class RequestStats {
7   maxRequestsInParallel: number;
8   milliSecondsInterval: number;
9   remainingMilliSeconds: number;
10   requests: Request[];
11
12   constructor(hash: {
13     maxRequestsInParallel: number,
14     milliSecondsInterval: number,
15     remainingMilliSeconds: number,
16     requests: Request[];
17   }) {
18     this.maxRequestsInParallel = hash.maxRequestsInParallel;
19     this.milliSecondsInterval = hash.milliSecondsInterval;
20     this.remainingMilliSeconds = hash.remainingMilliSeconds;
21     this.requests = hash.requests;
22   }
23
24   get remainingSeconds() {
25     return Math.floor(this.remainingMilliSeconds / 1000);
26   }
27
28   get secondsInterval() {
29     return Math.floor(this.milliSecondsInterval / 1000);
30   }
31
32 }