()
| 76 | } |
| 77 | |
| 78 | _reportLoad() { |
| 79 | debug(`LoadEstimator._reportLoad(): jobType = ${this.jobType}`); |
| 80 | this._warnOldJobs(); |
| 81 | var params = { |
| 82 | instance_id: config.instanceId, |
| 83 | group_name: config.groupName, |
| 84 | job_type: this.jobType, |
| 85 | average_jobs: this._getAndResetLoadEstimate(), |
| 86 | max_jobs: this.maxJobCount, |
| 87 | }; |
| 88 | sqldb.query(sql.insert_load, params, (err) => { |
| 89 | if (err) logger.error('Error reporting load', {err}); |
| 90 | if (!this.active) return; |
| 91 | debug(`LoadEstimator._reportLoad(): jobType = ${this.jobType}, scheduling next call for ${config.reportIntervalSec * 1000} ms`); |
| 92 | this.timeoutID = setTimeout(this._reportLoad.bind(this), config.reportIntervalSec * 1000); |
| 93 | }); |
| 94 | } |
| 95 | |
| 96 | _warnOldJobs() { |
| 97 | debug(`LoadEstimator._warnOldJobs(): jobType = ${this.jobType}`); |
no test coverage detected