MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / _reportLoad

Method _reportLoad

lib/load.js:78–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}`);

Callers 1

constructorMethod · 0.95

Calls 3

_warnOldJobsMethod · 0.95
debugFunction · 0.85

Tested by

no test coverage detected