Skip to content

fix: use query level statement_timeout - #947

Merged
avallete merged 8 commits into
masterfrom
fix/only-add-statement-timeout-on-direct-connection
May 28, 2025
Merged

avallete merged 8 commits into
masterfrom
fix/only-add-statement-timeout-on-direct-connection

Conversation

@avallete

@avallete avallete commented May 21, 2025 •

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Some non direct connectionString (such as pgBouncer or other poolers) won't support the statement_timeout parameter being set at connection level.

To circumvent that, setting the statement_timeout at the query level as a prefix.

Make it an optional parameter for the /query route.

@avallete
avallete force-pushed the fix/only-add-statement-timeout-on-direct-connection branch from 949f655 to e41138a Compare May 21, 2025 14:08
@coveralls

coveralls commented May 21, 2025 •

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 15280901649

Details

  • 18 of 19 (94.74%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 76.093%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/lib/db.ts 11 12 91.67%
Totals Coverage Status
Change from base Build 15139853007: 0.02%
Covered Lines: 5170
Relevant Lines: 6710

💛 - Coveralls

@avallete
avallete marked this pull request as ready for review May 21, 2025 14:13
@avallete
avallete requested review from a team as code owners May 21, 2025 14:13
@avallete avallete changed the title fix: exclude pooler from statement_timeout fix: use query level statement_timeout May 22, 2025
@avallete
avallete force-pushed the fix/only-add-statement-timeout-on-direct-connection branch from a43da4e to 4150b26 Compare May 22, 2025 09:05
Comment thread src/lib/secrets.ts
Comment on lines +15 to +16
// Use dynamic import to support module mock
const fs = await import('node:fs/promises')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

note

The dynamic module import need to be within the function to avoid other imports of constant.ts to possibly break the mocks in the tests.

Performance impact should be minimal as we just use it at server startup time.

@avallete
avallete requested a review from soedirgo May 22, 2025 09:43
@avallete
avallete merged commit fe4075a into master May 28, 2025
@avallete
avallete deleted the fix/only-add-statement-timeout-on-direct-connection branch May 28, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants