Primeiro commit do projeto Angular
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LeastBusyBalancer = LeastBusyBalancer;
|
||||
function LeastBusyBalancer(opts) {
|
||||
const { maximumUsage } = opts;
|
||||
return (task, workers) => {
|
||||
let candidate = null;
|
||||
let checkpoint = maximumUsage;
|
||||
for (const worker of workers) {
|
||||
if (worker.currentUsage === 0) {
|
||||
candidate = worker;
|
||||
break;
|
||||
}
|
||||
if (worker.isRunningAbortableTask)
|
||||
continue;
|
||||
if (task.isAbortable === false &&
|
||||
(worker.currentUsage < checkpoint)) {
|
||||
candidate = worker;
|
||||
checkpoint = worker.currentUsage;
|
||||
}
|
||||
}
|
||||
return candidate;
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
Reference in New Issue
Block a user