()
| 52 | } |
| 53 | |
| 54 | _getAndResetLoadEstimate() { |
| 55 | debug(`LoadEstimator._getAndResetLoadEstimate(): jobType = ${this.jobType}`); |
| 56 | this._addIntegratedLoad(); |
| 57 | const nowMS = Date.now(); |
| 58 | const deltaSeconds = Math.max(1, nowMS - this.lastEstimateTimeMS) / 1000; |
| 59 | const loadEstimate = this.integratedLoad / deltaSeconds; |
| 60 | |
| 61 | // reset stats |
| 62 | this.lastEstimateTimeMS = nowMS; |
| 63 | this.lastIncrementTimeMS = nowMS; |
| 64 | this.integratedLoad = 0; |
| 65 | |
| 66 | return loadEstimate; |
| 67 | } |
| 68 | |
| 69 | _addIntegratedLoad() { |
| 70 | debug(`LoadEstimator._addIntegratedLoad(): jobType = ${this.jobType}`); |
no test coverage detected