Skip to content

Conversation

@janko
Copy link
Contributor

@janko janko commented Nov 10, 2025

There is no need to reuse database connections for the LSP server, as the overhead of establishing new connections locally is negligible, and the schema cache remains populated even after disconnect. Therefore, we can close any active database connections as soon as we're done with the request.

Closes #536

@janko janko requested a review from a team as a code owner November 10, 2025 20:55
There is no need to reuse database connections for the LSP server, as
the overhead of establishing new connections locally is negligible.
Therefore, we can close any active database connections as soon as
we're done with the request.
@janko janko force-pushed the disconnect-from-database branch from 1ad7415 to 9593a30 Compare November 10, 2025 20:56
@janko janko changed the title Close any database connections at the end of each request Close any database connections at the end of request Nov 10, 2025
@vinistock vinistock added the bugfix This PR fixes an existing bug label Nov 11, 2025
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

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

Nice. Thanks for the contribution!

I measured locally and the price we pay for having to establish the connection every time is around 2ms, so I think it should be fine.

We also have no way of selectively dropping the connection. I believe this is the way to go

@vinistock vinistock merged commit 5e5afe9 into Shopify:main Nov 11, 2025
12 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This PR fixes an existing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ruby LSP Rails prevents dropping the database by keeping an active connection

2 participants