mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Fix request schedulers stats
This commit is contained in:
parent
05a9feaa48
commit
99fdec4648
8 changed files with 148 additions and 62 deletions
|
@ -12,6 +12,7 @@ module.exports = class BaseRequestScheduler {
|
|||
constructor (options) {
|
||||
this.lastRequestTimestamp = 0
|
||||
this.timer = null
|
||||
this.requestInterval = constants.REQUESTS_INTERVAL
|
||||
}
|
||||
|
||||
activate () {
|
||||
|
@ -21,7 +22,7 @@ module.exports = class BaseRequestScheduler {
|
|||
this.timer = setInterval(() => {
|
||||
this.lastRequestTimestamp = Date.now()
|
||||
this.makeRequests()
|
||||
}, constants.REQUESTS_INTERVAL)
|
||||
}, this.requestInterval)
|
||||
}
|
||||
|
||||
deactivate () {
|
||||
|
@ -41,6 +42,10 @@ module.exports = class BaseRequestScheduler {
|
|||
return constants.REQUESTS_INTERVAL - (Date.now() - this.lastRequestTimestamp)
|
||||
}
|
||||
|
||||
remainingRequestsCount (callback) {
|
||||
return this.getRequestModel().countTotalRequests(callback)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Make a requests to friends of a certain type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue