Forge database pool caps are config values and a change recreates the forge (issue 1966, recovery)
mesh/delivery merged: source.main moved to novox/mesh-catalog@53d173aa7de5
mesh/check checking 4becc7bd8312 on 53d173aa7de5
mesh/delivery merged: source.main moved to novox/mesh-catalog@53d173aa7de5
mesh/check checking 4becc7bd8312 on 53d173aa7de5
The caps were literals in server.env and the container named no restart-on, so a changed env-file never reached the running forge. They are now three gitea config values placed with ${config:...}, and the server container restarts on server-env.
Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
This commit is contained in:
@@ -3,11 +3,24 @@ import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
// The forge's own database pool is capped (issue 1966): the store's connections are shared by every module on the machine.
|
||||
// The caps are config values placed into the env-file, and a changed env-file recreates the container.
|
||||
const env = readFileSync(new URL("../files/server.env", import.meta.url), "utf8");
|
||||
const manifest = JSON.parse(readFileSync(new URL("../module.json", import.meta.url), "utf8"));
|
||||
|
||||
test("the forge caps its database pool", () => {
|
||||
test("the forge's pool caps are config values, placed in server.env, and a change recreates the container", () => {
|
||||
const lines = env.split("\n");
|
||||
for (const line of ["GITEA__database__MAX_OPEN_CONNS=40", "GITEA__database__MAX_IDLE_CONNS=10", "GITEA__database__CONN_MAX_LIFETIME=5m"]) {
|
||||
assert.ok(lines.includes(line), `server.env lacks ${line}`);
|
||||
const placed: Record<string, [string, unknown]> = {
|
||||
GITEA__database__MAX_OPEN_CONNS: ["database-max-open-connections", 40],
|
||||
GITEA__database__MAX_IDLE_CONNS: ["database-max-idle-connections", 10],
|
||||
GITEA__database__CONN_MAX_LIFETIME: ["database-connection-lifetime", "5m"],
|
||||
};
|
||||
for (const [name, [key, def]] of Object.entries(placed)) {
|
||||
assert.ok(lines.includes(`${name}=\${config:${key}}`), `server.env does not place ${key} at ${name}`);
|
||||
assert.equal(manifest.config[key].default, def);
|
||||
assert.equal(manifest.config[key].trusted, false);
|
||||
assert.ok(manifest.config[key].description.includes("100 connections"));
|
||||
}
|
||||
assert.equal(manifest.config["database-max-open-connections"].minimum, 1);
|
||||
const server = manifest.resources.find((r: { id: string }) => r.id === "server");
|
||||
assert.deepEqual(server["restart-on"], ["server-env"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user