Skip to content

Commit db74757

Browse files
committed
remove caching tcp, enhance sidebar
1 parent 2bf9822 commit db74757

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

cron-vercel/lib/bench-db.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,15 @@ interface BenchDbConfig {
99
connectionMethod: string;
1010
}
1111

12-
// Cache for TCP connection pools to enable reuse across requests
13-
const tcpPools = new Map<string, PgPool>();
14-
15-
export function getTcpPool(connectionUrl: string): PgPool {
16-
if (!tcpPools.has(connectionUrl)) {
17-
const pool = new PgPool({ connectionString: connectionUrl });
18-
attachDatabasePool(pool);
19-
tcpPools.set(connectionUrl, pool);
20-
}
21-
return tcpPools.get(connectionUrl)!;
22-
}
23-
2412
export function getBenchDb({ connectionUrl, connectionMethod }: BenchDbConfig) {
2513
if (!connectionUrl) {
2614
throw new Error("Connection URL is required");
2715
}
2816

2917
if (connectionMethod === "tcp") {
30-
return getTcpPool(connectionUrl);
18+
const pool = new PgPool({ connectionString: connectionUrl });
19+
attachDatabasePool(pool);
20+
return pool;
3121
}
3222

3323
if (connectionMethod === "ws") {

dashboard/components/database-sidebar.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ export function DatabaseSidebar({
343343
@neondatabase/serverless{" "}
344344
{methodGroup.connectionMethod === "http"
345345
? "http"
346-
: "websocket"}
346+
: methodGroup.connectionMethod === "tcp"
347+
? "tcp"
348+
: "websocket"}
347349
</h4>
348350
{methodGroup.regions.map((group) => (
349351
<div

0 commit comments

Comments
 (0)