Skip to content

Commit

Permalink
Add hasMaxActiveCompilersBeenReached to /compiler-info (#19)
Browse files Browse the repository at this point in the history
* Add areActiveCompilersAtMax to /compiler-info

* Rename function to hasMaxActiveCompilersBeenReached
  • Loading branch information
azu-b authored Apr 29, 2022
1 parent c7557f1 commit 56ead01
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,13 @@ class Kevin {
compilers[name] = { status: NOT_BUILT };
});

res.json({ compilers, leastUsedCompiler });
const hasMaxActiveCompilersBeenReached = this.hasMaxActiveCompilersBeenReached();

res.json({
compilers,
leastUsedCompiler,
hasMaxActiveCompilersBeenReached,
});
return;
}

Expand Down Expand Up @@ -577,6 +583,17 @@ class Kevin {
\`, 'font-weight: bold; font-size: 1.5em', '')`;
res.send(jsString);
}

/** It determines whether Kevin has reached the maximum of active compilers or not
* @returns {Boolean} True if Kevin is at the maximum, false if not.
*/
hasMaxActiveCompilersBeenReached() {
const activeCompilerCount = manager.countActiveCompilers();
if (activeCompilerCount === this.maxCompilers) {
return true;
}
return false;
}
}

module.exports = Kevin;

0 comments on commit 56ead01

Please sign in to comment.