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
2 changes: 1 addition & 1 deletion src/server/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const GENERATE_TYPES_DETECT_ONE_TO_ONE_RELATIONSHIPS =

export const DEFAULT_POOL_CONFIG: PoolConfig = {
max: 1,
connectionTimeoutMillis: PG_CONN_TIMEOUT_SECS * 1000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this results in the default of 0 taking over - which is not what we want.

query_timeout: PG_CONN_TIMEOUT_SECS * 1000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A connection timeout is not a query timeout. imo it's very misleading to feed in a "CONN_TIMEOUT" here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, made a PR to revert it: #777

ssl: PG_META_DB_SSL_ROOT_CERT ? { ca: PG_META_DB_SSL_ROOT_CERT } : undefined,
}

Expand Down
15 changes: 15 additions & 0 deletions test/server/query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from 'vitest'
import { app } from './utils'
import { DEFAULT_POOL_CONFIG } from '../../src/server/constants'

test('query', async () => {
const res = await app.inject({
Expand Down Expand Up @@ -539,3 +540,17 @@ test('very big number', async () => {
]
`)
})

test('query timeout', async () => {
const defaultTimeout = DEFAULT_POOL_CONFIG.query_timeout
DEFAULT_POOL_CONFIG.query_timeout = 100

const res = await app.inject({
method: 'POST',
path: '/query',
payload: { query: "select pg_sleep_for('1 minute');" },
})
expect(res.json()?.error).toMatchInlineSnapshot(`"Query read timeout"`)

DEFAULT_POOL_CONFIG.query_timeout = defaultTimeout
})