WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto

fix(appview): close postgres connection after each admin test to prevent pool exhaustion (ATB-45)

Each createTestContext() call opens a new postgres.js connection pool. With 93
tests in admin.test.ts, the old pools were never closed, exhausting PostgreSQL's
max_connections limit. Fix by calling $client.end() in cleanup() for Postgres.

+6 -1
+6 -1
apps/appview/src/lib/__tests__/test-context.ts
··· 183 183 await db.delete(backfillErrors).catch(() => {}); 184 184 await db.delete(backfillProgress).catch(() => {}); 185 185 await db.delete(forums).where(eq(forums.did, config.forumDid)); 186 - // No sql.end() needed — createDb owns the client lifecycle 186 + // Close the postgres.js connection pool to prevent connection exhaustion. 187 + // With many tests each calling createTestContext(), every call opens a new 188 + // pool. Without end(), the pool stays open and PostgreSQL hits max_connections. 189 + if (isPostgres) { 190 + await (db as any).$client?.end?.(); 191 + } 187 192 }, 188 193 } as TestContext; 189 194 }