Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close underlying connections during migration #12710

Merged
merged 1 commit into from
May 11, 2022

Conversation

jdpgrailsdev
Copy link
Contributor

What

  • Ensure connections are released

How

  • Properly close DataSource/DSLContext within jOOQ database objects

Recommended reading order

  1. FlywayMigraitonDatabase.java

🚨 User Impact 🚨

None

Tests

Unit
  • All unit tests pass
  • Database model objects successfully generated during build

@jdpgrailsdev jdpgrailsdev requested a review from lmossman May 9, 2022 20:47
@jdpgrailsdev jdpgrailsdev temporarily deployed to more-secrets May 9, 2022 20:47 Inactive
@jdpgrailsdev jdpgrailsdev temporarily deployed to more-secrets May 9, 2022 20:47 Inactive
Copy link
Contributor

@lmossman lmossman left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -91,6 +100,14 @@ private void createInternalConnection() throws Exception {
public void close() {
JDBCUtils.safeClose(connection);
connection = null;
dslContext.close();
if (dataSource instanceof Closeable closeable) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't know you could assign a variable of that type in this statement like this, thats cool!

@jdpgrailsdev jdpgrailsdev merged commit 1a999b7 into master May 11, 2022
@jdpgrailsdev jdpgrailsdev deleted the jonathan/migration-database-close branch May 11, 2022 20:12
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.

2 participants