aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/base-request-scheduler.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-02-27 21:56:55 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-02-27 21:56:55 +0100
commit99fdec464802e5d720fe08ead06b63368b115baf (patch)
treed3129ec4e37894036fc8e83ee17a953873f41e12 /server/lib/base-request-scheduler.js
parent05a9feaa48cea560abd9561434a3479ab1021643 (diff)
downloadPeerTube-99fdec464802e5d720fe08ead06b63368b115baf.tar.gz
PeerTube-99fdec464802e5d720fe08ead06b63368b115baf.tar.zst
PeerTube-99fdec464802e5d720fe08ead06b63368b115baf.zip
Fix request schedulers stats
Diffstat (limited to 'server/lib/base-request-scheduler.js')
-rw-r--r--server/lib/base-request-scheduler.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/lib/base-request-scheduler.js b/server/lib/base-request-scheduler.js
index 309c1a261..1c6b78297 100644
--- a/server/lib/base-request-scheduler.js
+++ b/server/lib/base-request-scheduler.js
@@ -12,6 +12,7 @@ module.exports = class BaseRequestScheduler {
12 constructor (options) { 12 constructor (options) {
13 this.lastRequestTimestamp = 0 13 this.lastRequestTimestamp = 0
14 this.timer = null 14 this.timer = null
15 this.requestInterval = constants.REQUESTS_INTERVAL
15 } 16 }
16 17
17 activate () { 18 activate () {
@@ -21,7 +22,7 @@ module.exports = class BaseRequestScheduler {
21 this.timer = setInterval(() => { 22 this.timer = setInterval(() => {
22 this.lastRequestTimestamp = Date.now() 23 this.lastRequestTimestamp = Date.now()
23 this.makeRequests() 24 this.makeRequests()
24 }, constants.REQUESTS_INTERVAL) 25 }, this.requestInterval)
25 } 26 }
26 27
27 deactivate () { 28 deactivate () {
@@ -41,6 +42,10 @@ module.exports = class BaseRequestScheduler {
41 return constants.REQUESTS_INTERVAL - (Date.now() - this.lastRequestTimestamp) 42 return constants.REQUESTS_INTERVAL - (Date.now() - this.lastRequestTimestamp)
42 } 43 }
43 44
45 remainingRequestsCount (callback) {
46 return this.getRequestModel().countTotalRequests(callback)
47 }
48
44 // --------------------------------------------------------------------------- 49 // ---------------------------------------------------------------------------
45 50
46 // Make a requests to friends of a certain type 51 // Make a requests to friends of a certain type