-
Notifications
You must be signed in to change notification settings - Fork 205
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
sandbox: Wait for a database to be available instead of crashing immediately #6146
Conversation
fdfee7f
to
d4c16aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine as is. Remember you should add the changelog entry to your commit(s). I've done it for you. In the future, the PR template comes with a checklist with the relevant links.
...andbox/src/main/scala/com/digitalasset/platform/store/dao/HikariJdbcConnectionProvider.scala
Outdated
Show resolved
Hide resolved
...andbox/src/main/scala/com/digitalasset/platform/store/dao/HikariJdbcConnectionProvider.scala
Outdated
Show resolved
Hide resolved
...andbox/src/main/scala/com/digitalasset/platform/store/dao/HikariJdbcConnectionProvider.scala
Outdated
Show resolved
Hide resolved
...andbox/src/main/scala/com/digitalasset/platform/store/dao/HikariJdbcConnectionProvider.scala
Outdated
Show resolved
Hide resolved
4d0771a
to
0d902be
Compare
...andbox/src/main/scala/com/digitalasset/platform/store/dao/HikariJdbcConnectionProvider.scala
Outdated
Show resolved
Hide resolved
eab7391
to
e1e754b
Compare
…diately on startup. changelog_begin [Sandbox] Wait for a database to be available instead of crashing immediately on startup. changelog_end
e1e754b
to
5301885
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only two suggestions. The one on logging is fairly important in my opinion, for the other I trust your judgement. 🙂
// Postgres and Sandbox can be started in any order. | ||
Resource( | ||
RetryStrategy.constant(attempts = 600, waitTime = 1.second) { (_, _) => | ||
Future { new HikariDataSource(config) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a log line before this one to give some feedback as to what's going on. The parameters of the anonymous function should give some meaningful information. info
level should be enough.
metrics | ||
) | ||
|
||
final class Owner( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would probably make sense to move this in its own file and giving it a meaningful name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just make HikariConnection
itself a ResourceOwner
. I don't think there's a need for the indirection.
metrics | ||
) | ||
|
||
final class Owner( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just make HikariConnection
itself a ResourceOwner
. I don't think there's a need for the indirection.
f3023b9
to
102b65c
Compare
Wait for a database to be available instead of crashing immediately on startup.
Pull Request Checklist
CHANGELOG_BEGIN
andCHANGELOG_END
tagsNOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.