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

Update Play to 2.7.0-RC8 #446

Merged
merged 2 commits into from
Nov 29, 2018
Merged

Update Play to 2.7.0-RC8 #446

merged 2 commits into from
Nov 29, 2018

Conversation

marcospereira
Copy link
Member

No description provided.

@codecov-io
Copy link

codecov-io commented Nov 29, 2018

Codecov Report

Merging #446 into master will decrease coverage by 0.32%.
The diff coverage is 27.58%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #446      +/-   ##
========================================
- Coverage    7.82%   7.5%   -0.33%     
========================================
  Files          19     19              
  Lines         843    853      +10     
  Branches       10     11       +1     
========================================
- Hits           66     64       -2     
- Misses        777    789      +12
Impacted Files Coverage Δ
...src/main/scala/play/api/db/slick/SlickModule.scala 86.66% <100%> (ø) ⬆️
...pi/db/slick/evolutions/internal/DBApiAdapter.scala 33.33% <25%> (-16.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e04f5e8...ff96032. Read the comment docs.

@@ -47,7 +47,7 @@ final class SlickModule extends Module {
if (dbs.contains(default)) Seq(bind[DatabaseConfigProvider].to(bindNamed(default))) else Nil

def bindNamed(name: String): BindingKey[DatabaseConfigProvider] =
bind(classOf[DatabaseConfigProvider]).qualifiedWith(new NamedDatabaseImpl(name))
Copy link
Member Author

Choose a reason for hiding this comment

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

Just to avoid a deprecated API.

val conn = getConnection()
conn.setAutoCommit(autocommit)
conn
override def getConnection(autocommit: Boolean): Connection = {
Copy link
Member Author

Choose a reason for hiding this comment

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

This implementation is now consistent with what we have in Play and fixes a possible connection leak if it fails to setAutoCommit.

Copy link
Member

Choose a reason for hiding this comment

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

Is this related in any way to #445 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is possible. But needs further investigation to confirm.

def withConnection[A](autocommit: Boolean)(block: Connection => A): A = withConnection { conn =>
conn.setAutoCommit(autocommit)
block(conn)
def withConnection[A](autocommit: Boolean)(block: Connection => A): A = {
Copy link
Member Author

Choose a reason for hiding this comment

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

Make this method the default base that other overloads of withConnection will use. It is responsible to execute a block and release the connection.

} finally {
if (!done) conn.rollback()
conn.close()
withConnection(autocommit = false) { connection =>
Copy link
Member Author

Choose a reason for hiding this comment

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

Not using done = true but instead handling the exceptions.

}
}

override def withTransaction[A](isolationLevel: TransactionIsolationLevel)(block: Connection => A): A = {
Copy link
Member Author

Choose a reason for hiding this comment

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

The new method override that uses TransactionIsolationLevel.

@marcospereira marcospereira merged commit 5957d76 into playframework:master Nov 29, 2018
@marcospereira marcospereira deleted the play-2.7.0-RC8 branch November 29, 2018 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants