Remove shared prepared statement cache (Refs #76)
CI / checks (push) Successful in 4m40s

This commit is contained in:
2026-10-09 17:05:06 -04:00
parent 4c1f2cdb8f
commit bd16737dd8
3 changed files with 68 additions and 27 deletions
@@ -328,9 +328,9 @@ describe('routine host observation retention', () => {
).toEqual({ count: 2000 });
});
it('reuses the same three delete statements across different batch sizes', async () => {
it('uses the same three delete query shapes across different batch sizes', async () => {
const api = await setup();
const statements = new Map<string, ReturnType<typeof api.handle.prepare>>();
const deleteQueries = new Set<string>();
for (const count of [1, 2, 7, 50, 500]) {
api.handle.transaction(() => {
const insert = api.handle.prepare(`INSERT INTO ec_host_operations
@@ -346,13 +346,9 @@ describe('routine host observation retention', () => {
.filter((sql) => sql.startsWith('DELETE FROM ec_host_'));
prepare.mockRestore();
expect(deletes).toHaveLength(3);
for (const sql of deletes) {
const statement = api.handle.prepare(sql);
if (statements.has(sql)) expect(statement).toBe(statements.get(sql));
statements.set(sql, statement);
}
for (const sql of deletes) deleteQueries.add(sql);
}
expect(statements.size).toBe(3);
expect(deleteQueries.size).toBe(3);
expect(api.handle.pragma('foreign_key_check')).toEqual([]);
});