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

Method constructor

lib/load.js:11–24  ·  view source on GitHub ↗
(jobType, maxJobCount, warnOnOldJobs)

Source from the content-addressed store, hash-verified

9
10class LoadEstimator {
11 constructor(jobType, maxJobCount, warnOnOldJobs) {
12 debug(`LoadEstimator(): jobType = ${jobType}`);
13 this.jobType = jobType;
14 const nowMS = Date.now();
15 this.lastEstimateTimeMS = nowMS;
16 this.lastIncrementTimeMS = nowMS;
17 this.integratedLoad = 0;
18 this.currentJobs = {};
19 this.maxJobCount = maxJobCount || 1;
20 this.warnOnOldJobs = (warnOnOldJobs == null) ? true : warnOnOldJobs;
21 this.timeoutID = null;
22 this.active = true;
23 this._reportLoad();
24 }
25
26 startJob(id) {
27 debug(`LoadEstimator.startJob(): jobType = ${this.jobType}, id = ${id}`);

Callers 6

MrFunction · 0.45
jquery.jsFile · 0.45
nFunction · 0.45
math.jsFile · 0.45
sFunction · 0.45
cFunction · 0.45

Calls 2

_reportLoadMethod · 0.95
debugFunction · 0.85

Tested by

no test coverage detected