aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/request-schedulers/shared/request-schedulers-stats-attributes.model.ts
blob: c4abf3d4db477eb0dc90e0f9eb8ea9b3140c61af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { RequestSchedulerStatsAttributes as FormattedRequestSchedulerStatsAttributes } from '../../../../../../shared'

export interface Request {
  request: any
  to: any
}

export class RequestSchedulerStatsAttributes implements FormattedRequestSchedulerStatsAttributes {
  requestsLimitPods: number
  requestsLimitPerPod: number
  milliSecondsInterval: number
  remainingMilliSeconds: number
  totalRequests: number

  constructor (hash: {
    requestsLimitPods: number,
    requestsLimitPerPod: number,
    milliSecondsInterval: number,
    remainingMilliSeconds: number,
    totalRequests: number
  }) {
    this.requestsLimitPods = hash.requestsLimitPods
    this.requestsLimitPerPod = hash.requestsLimitPerPod
    this.milliSecondsInterval = hash.milliSecondsInterval
    this.remainingMilliSeconds = hash.remainingMilliSeconds
    this.totalRequests = hash.totalRequests
  }

  get remainingSeconds () {
    return Math.floor(this.remainingMilliSeconds / 1000)
  }

  get secondsInterva () {
    return Math.floor(this.milliSecondsInterval / 1000)
  }

}