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

sandbox: Wait for a database to be available instead of crashing immediately #6146

Merged
merged 5 commits into from
Jun 4, 2020

Conversation

da-tanabe
Copy link
Contributor

Wait for a database to be available instead of crashing immediately on startup.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@stefanobaghino-da stefanobaghino-da force-pushed the sandbox-wait-for-db branch 2 times, most recently from fdfee7f to d4c16aa Compare May 28, 2020 14:18
Copy link
Contributor

@stefanobaghino-da stefanobaghino-da left a 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.

@stefanobaghino-da stefanobaghino-da self-requested a review May 28, 2020 14:23
@da-tanabe da-tanabe force-pushed the sandbox-wait-for-db branch 3 times, most recently from 4d0771a to 0d902be Compare May 28, 2020 19:43
@da-tanabe da-tanabe force-pushed the sandbox-wait-for-db branch 7 times, most recently from eab7391 to e1e754b Compare June 3, 2020 21:52
…diately on startup.

changelog_begin
[Sandbox] Wait for a database to be available instead of crashing
immediately on startup.
changelog_end
@da-tanabe da-tanabe force-pushed the sandbox-wait-for-db branch from e1e754b to 5301885 Compare June 3, 2020 21:58
@da-tanabe da-tanabe marked this pull request as ready for review June 3, 2020 22:49
Copy link
Contributor

@stefanobaghino-da stefanobaghino-da left a 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) }
Copy link
Contributor

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(
Copy link
Contributor

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.

Copy link

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(
Copy link

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.

@da-tanabe da-tanabe force-pushed the sandbox-wait-for-db branch from f3023b9 to 102b65c Compare June 4, 2020 16:31
@da-tanabe da-tanabe merged commit ae463b6 into master Jun 4, 2020
@da-tanabe da-tanabe deleted the sandbox-wait-for-db branch June 4, 2020 18:33
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