maybe now the max conns work?
Build and Push Docker Images / build-and-push (push) Successful in 20s
Build and Push Docker Images / build-and-push (push) Successful in 20s
This commit is contained in:
1 parent
8ca69eecae
commit
2942f48ded
3 files changed
+5
-28
No files matched your search
@@ -77,7 +77,7 @@ function readConfigEntries() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const url of validUrls) {
|
for (const url of validUrls) {
|
||||||
entries.push({ url, username, password, entryId: index });
|
entries.push({ url, username, password });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return entries;
|
return entries;
|
||||||
@@ -102,12 +102,7 @@ function reloadConfig() {
|
|||||||
seen.add(upstream.key);
|
seen.add(upstream.key);
|
||||||
|
|
||||||
const existing = previous.get(upstream.key);
|
const existing = previous.get(upstream.key);
|
||||||
if (existing) {
|
next.push(existing || upstream);
|
||||||
existing.entryId = upstream.entryId;
|
|
||||||
next.push(existing);
|
|
||||||
} else {
|
|
||||||
next.push(upstream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const removed = upstreams.filter((u) => !seen.has(u.key)).length;
|
const removed = upstreams.filter((u) => !seen.has(u.key)).length;
|
||||||
|
|||||||
@@ -26,30 +26,13 @@ function isBusy(upstream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function totalConnectionCapacity() {
|
function totalConnectionCapacity() {
|
||||||
const perEntry = new Map();
|
let total = 0;
|
||||||
|
|
||||||
for (const upstream of getUpstreams()) {
|
for (const upstream of getUpstreams()) {
|
||||||
const entryId = upstream.entryId ?? upstream.key;
|
|
||||||
const current = perEntry.get(entryId);
|
|
||||||
const maxCons = upstream.state.maxCons;
|
const maxCons = upstream.state.maxCons;
|
||||||
|
|
||||||
if (!current) {
|
|
||||||
perEntry.set(entryId, { maxCons });
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxCons !== null && maxCons > 0) {
|
|
||||||
current.maxCons =
|
|
||||||
current.maxCons === null || current.maxCons <= 0
|
|
||||||
? maxCons
|
|
||||||
: Math.max(current.maxCons, maxCons);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let total = 0;
|
|
||||||
for (const { maxCons } of perEntry.values()) {
|
|
||||||
total += maxCons !== null && maxCons > 0 ? maxCons : 1;
|
total += maxCons !== null && maxCons > 0 ? maxCons : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function baseState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Upstream {
|
class Upstream {
|
||||||
constructor({ url, username, password, entryId }) {
|
constructor({ url, username, password }) {
|
||||||
const parsed = new URL(url);
|
const parsed = new URL(url);
|
||||||
parsed.hash = '';
|
parsed.hash = '';
|
||||||
parsed.search = '';
|
parsed.search = '';
|
||||||
@@ -27,7 +27,6 @@ class Upstream {
|
|||||||
this.basePath = parsed.pathname.replace(/\/+$/, '');
|
this.basePath = parsed.pathname.replace(/\/+$/, '');
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.entryId = entryId;
|
|
||||||
this.key = `${parsed.origin}${this.basePath}|${username}|${password}`;
|
this.key = `${parsed.origin}${this.basePath}|${username}|${password}`;
|
||||||
this.state = { ...baseState(), inFlight: 0 };
|
this.state = { ...baseState(), inFlight: 0 };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user