Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 0 additions & 1 deletion .github/workflows/publish-ts-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
registry-url: 'https://registry.npmjs.org/'

- name: Install dependencies
working-directory: packages/ts-sdk
run: bun install

- name: Run tests
Expand Down
8 changes: 4 additions & 4 deletions apps/sim/socket-server/database/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const connectionString = env.DATABASE_URL
const socketDb = drizzle(
postgres(connectionString, {
prepare: false,
idle_timeout: 10,
connect_timeout: 20,
max: 15,
idle_timeout: 20,
connect_timeout: 10,
max: 5,
onnotice: () => {},
}),
{ schema }
)

// Use dedicated connection for socket operations, fallback to shared db for compatibility
// Use dedicated connection for socket operations
const db = socketDb

// Constants
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/socket-server/rooms/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const connectionString = env.DATABASE_URL
const db = drizzle(
postgres(connectionString, {
prepare: false,
idle_timeout: 15,
connect_timeout: 20,
idle_timeout: 20,
connect_timeout: 10,
max: 3,
onnotice: () => {},
}),
Expand Down
21 changes: 2 additions & 19 deletions packages/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,11 @@ if (!connectionString) {
throw new Error('Missing DATABASE_URL environment variable')
}

console.log(
'[DB Pool Init]',
JSON.stringify({
timestamp: new Date().toISOString(),
nodeEnv: process.env.NODE_ENV,
action: 'CREATING_CONNECTION_POOL',
poolConfig: {
max: 30,
idle_timeout: 20,
connect_timeout: 30,
prepare: false,
},
pid: process.pid,
isProduction: process.env.NODE_ENV === 'production',
})
)

const postgresClient = postgres(connectionString, {
prepare: false,
idle_timeout: 20,
connect_timeout: 30,
max: 30,
connect_timeout: 10,
max: 20,
onnotice: () => {},
})

Expand Down
1 change: 1 addition & 0 deletions packages/ts-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "simstudio-ts-sdk",
"version": "0.1.0",
"description": "Sim SDK - Execute workflows programmatically",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-sdk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"module": "ES2020",
"lib": ["ES2020"],
"outDir": "./dist",
"rootDir": "./src",
Expand Down
3 changes: 3 additions & 0 deletions packages/ts-sdk/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ export default defineConfig({
include: ['src/**/*.test.{ts,tsx}', 'tests/**/*.test.{ts,tsx}'],
exclude: ['**/node_modules/**', '**/dist/**'],
},
resolve: {
conditions: ['node', 'default'],
},
})