Skip to content

Commit fb1ea10

Browse files
Jagadeeshftwclaude
andcommitted
fix(db): repair merged duplicate in waitForDbReadiness
Two implementations had been spliced together: `if (result.healthy) {` was opened and never closed, followed by a second check that assigned the result object to `healthy` and tested it for truthiness — which is always true, since checkDbHealth returns HealthCheckResult rather than a boolean. Kept the single correct check. src/db/health.test.ts asserts exactly two pool queries for "resolves after the database becomes reachable", which only holds with one health call per attempt. The `dbModule` self-import existed solely for the duplicated call and is now unused, so it goes too. This file compiles again; contact.ts, migration.test.ts and transactions.ts remain broken and are tracked as Stage 3 work. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 91d17cf commit fb1ea10

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

src/db/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { drizzle } from "drizzle-orm/node-postgres";
22
import { Pool } from "pg";
33
import { env } from "../config.js";
44
import * as schema from "./schema.js";
5-
import * as dbModule from "./index.js";
65

76
// Pool tuning shared across whichever connection string we end up using.
87
// Bounded size plus idle/connection timeouts keep a stuck DB from exhausting the pool.
@@ -146,8 +145,6 @@ export async function waitForDbReadiness(): Promise<void> {
146145
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
147146
const result = await checkDbHealth();
148147
if (result.healthy) {
149-
const healthy = await dbModule.checkDbHealth();
150-
if (healthy) {
151148
return;
152149
}
153150
if (attempt < maxAttempts) {

0 commit comments

Comments
 (0)