All checks were successful
deploy / deploy (push) Successful in 48s
Instead of fetching up to 50k inventory snapshots (~442MB), scope the query to only the time range of the current submission batch with a 15-minute buffer. For a typical 1-hour batch this drops from 50k rows to ~300 rows, well within the 1280Mi pod memory limit. The coalesced_at_idx on intent_inventory_snapshots covers the BETWEEN clause so this remains efficient. Proof: history-writer OOM kills from refreshQuoteOutcomes inventory fetch Assumptions: 15min buffer covers the attribution window for all submissions Still fake: heuristic gap outcomes may attribute trades imprecisely
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { spawnSync } from 'node:child_process';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { dirname, resolve } from 'node:path';
|
|
import net from 'node:net';
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = resolve(__dirname, '..');
|
|
const scriptPath = resolve(repoRoot, 'scripts/dev/operator-dashboard-dev.sh');
|
|
|
|
test('operator dashboard dev script fails fast on a stale occupied upstream port', async (t) => {
|
|
const server = net.createServer();
|
|
await new Promise((resolvePromise, reject) => {
|
|
server.once('error', reject);
|
|
server.listen(0, '127.0.0.1', resolvePromise);
|
|
});
|
|
t.after(() => server.close());
|
|
|
|
const port = server.address().port;
|
|
const startedAt = Date.now();
|
|
const result = spawnSync('bash', [scriptPath], {
|
|
cwd: repoRoot,
|
|
encoding: 'utf8',
|
|
timeout: 2_000,
|
|
env: {
|
|
...process.env,
|
|
OPERATOR_DASHBOARD_DEV_BASIC_AUTH_PASSWORD: 'test-password',
|
|
OPERATOR_DASHBOARD_DEV_UPSTREAM_PORT: String(port),
|
|
OPERATOR_DASHBOARD_DEV_EXISTING_PORT_TIMEOUT_SECONDS: '0.2',
|
|
OPERATOR_DASHBOARD_DEV_READY_ATTEMPTS: '50',
|
|
},
|
|
});
|
|
|
|
assert.notEqual(result.error?.code, 'ETIMEDOUT');
|
|
assert.notEqual(result.status, 0);
|
|
assert.ok(Date.now() - startedAt < 1_500);
|
|
assert.match(result.stderr, /already in use but \/healthz did not respond/);
|
|
});
|