mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
perf(api): bound worker pools and add telemetry
Share one configured PostgreSQL pool across worker repositories and make API and worker connection budgets explicit. Add privacy-safe aggregate request, query, pool, sync, and outbox telemetry, a loopback-only representative load fixture, bounded worker shutdown, and focused regression and integration coverage. Document the database-wide budget formula and defer pg_stat_statements activation to a reviewed migration and planned restart.
This commit is contained in:
1 parent
a13bbc3f65
commit
5c973c4ac5
25 files changed
+471
-16
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { requireLocalApi, requireLoopback } from '../src/load/loopback.js';
|
||||
|
||||
describe('representative load fixture boundary', () => {
|
||||
it('accepts only loopback API and PostgreSQL URLs', () => {
|
||||
expect(requireLoopback('http://127.0.0.1:3003', 'API').hostname).toBe('127.0.0.1');
|
||||
expect(requireLoopback('postgresql://sauci:test@localhost:5432/sauci', 'DATABASE').hostname).toBe('localhost');
|
||||
expect(() => requireLoopback('https://api.sauci.example', 'API')).toThrow('must resolve to loopback');
|
||||
expect(() => requireLoopback('postgresql://sauci:test@db.internal:5432/sauci', 'DATABASE')).toThrow('must resolve to loopback');
|
||||
});
|
||||
|
||||
it('allows only the controlled local HTTP API port', () => {
|
||||
expect(requireLocalApi('http://127.0.0.1:3003').port).toBe('3003');
|
||||
expect(() => requireLocalApi('https://127.0.0.1:3003')).toThrow('must be http loopback');
|
||||
expect(() => requireLocalApi('http://127.0.0.1:3004')).toThrow('must be http loopback');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user