Skip to content

fix: fold timeout into scope query#1154

Merged
ferhatelmas merged 12 commits into
masterfrom
ferhat/timeout-fold-scope
Jul 8, 2026
Merged

fix: fold timeout into scope query#1154
ferhatelmas merged 12 commits into
masterfrom
ferhat/timeout-fold-scope

Conversation

@ferhatelmas

@ferhatelmas ferhatelmas commented Jun 15, 2026

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Refactor for perf

What is the current behavior?

Right now, statement timeout is sent separately which introduces extra round trip.

What is the new behavior?

Delay until the first statement (set_config) and combine them together in the same query to reduce one round trip to db.

Additional context

Additionally, make query text for scope module level, and cache headers/jwt payload for multiple queries in the same connection.

@ferhatelmas ferhatelmas requested a review from a team as a code owner June 15, 2026 09:32
Copilot AI review requested due to automatic review settings June 15, 2026 09:32
@coveralls

coveralls commented Jun 15, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 28955861975

Coverage decreased (-0.01%) to 79.218%

Details

  • Coverage decreased (-0.01%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (38 of 39 lines covered, 97.44%).
  • 18 coverage regressions across 2 files.

Uncovered Changes

File Changed Covered %
src/internal/database/pg-connection.ts 39 38 97.44%

Coverage Regressions

18 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
src/internal/http/agent.ts 17 32.56%
src/http/routes/s3/index.ts 1 82.99%

Coverage Stats

Coverage Status
Relevant Lines: 12562
Covered Lines: 10399
Line Coverage: 82.78%
Relevant Branches: 7277
Covered Branches: 5317
Branch Coverage: 73.07%
Branches in Coverage %: Yes
Coverage Strength: 422.39 hits per line

💛 - Coveralls

Comment thread src/internal/database/pg-connection.ts
@fenos

fenos commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

It's an interesting approach, but it might beat us in case we never call setScope on a query, and expect the timeout to still work.

Not sure if it's worth the performance gain here (1ms or less) vs a bit of a hidden timeout logic

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment thread src/internal/database/pg-connection.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@ferhatelmas

Copy link
Copy Markdown
Member Author

it might beat us in case we never call setScope on a query

that's fine and covered by a test

@ferhatelmas ferhatelmas force-pushed the ferhat/timeout-fold-scope branch from 827b5b4 to 7e10952 Compare June 24, 2026 14:17
Comment thread src/internal/database/pg-connection.ts Outdated
@ferhatelmas ferhatelmas force-pushed the ferhat/timeout-fold-scope branch from e14b434 to 1cfae52 Compare July 8, 2026 13:40
cache serialization of headers/jwt payload per request

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread src/test/storage-pg-db.test.ts Outdated
Comment thread src/test/storage-pg-db.test.ts Outdated
Comment thread src/internal/database/pg-connection.test.ts
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from Copilot July 8, 2026 15:34
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/internal/database/pg-connection.test.ts Outdated
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@ferhatelmas ferhatelmas merged commit 34a4d39 into master Jul 8, 2026
32 of 33 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/timeout-fold-scope branch July 8, 2026 18:02
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.

5 participants