Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/sim/socket-server/database/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ const socketDb = drizzle(
prepare: false,
idle_timeout: 10,
connect_timeout: 20,
max: 25,
max: 15,
onnotice: () => {},
debug: false,
}),
{ schema }
)
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/socket-server/rooms/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const db = drizzle(
prepare: false,
idle_timeout: 15,
connect_timeout: 20,
max: 5,
max: 3,
onnotice: () => {},
}),
{ schema }
Expand Down
12 changes: 2 additions & 10 deletions packages/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,8 @@ const postgresClient = postgres(connectionString, {
prepare: false,
idle_timeout: 20,
connect_timeout: 30,
max: 80,
max: 30,
onnotice: () => {},
})

const drizzleClient = drizzle(postgresClient, { schema })

declare global {
// eslint-disable-next-line no-var
var database: PostgresJsDatabase<typeof schema> | undefined
}

export const db = globalThis.database || drizzleClient
if (process.env.NODE_ENV !== 'production') globalThis.database = db
export const db = drizzle(postgresClient, { schema })