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

fix: waitfordb.sh: only try the database 30 times, and exit if connection cannot be made #2315

Merged
merged 3 commits into from
Jan 24, 2019

Conversation

parkr
Copy link

@parkr parkr commented Jan 17, 2019

Hello friends!

This is a fairly simple change. I use the official monicahq docker image (with some changes to allow me to bind to different ports) and I am very grateful for it! Thank you for shipping it and keeping it updated.

When you run the docker image (e.g. docker run --rm monicahq/monica:latest), it runs a Makefile by default which runs the test-server rule by default. This runs a waitfordb.sh script which verifies that the database server is up and listening. If the database server is not up and listening it will spin and spin and spin until you stop the container with docker stop.

In an effort to be a bit nicer to my servers and not have endlessly-spinning containers, I would like to propose capping the number of nc attempts we make in this script. What do you think?

Thank you!

Checklist

Before submitting the PR

  • Read the CONTRIBUTING document before submitting your PR.
  • If the PR is related to an issue or fix one, don't forget to indicate it.
  • Indicate [wip] in the title of the PR it is is not final yet. Remove [wip] when ready. Otherwise the PR will be considered complete and rejected if it's not working.

General checks

  • Make sure that the change you propose is the smallest possible.
  • The name of the PR should follow the conventional commits guideline that the project follows.

Other tasks

  • CHANGELOG entry added, if necessary, under UNRELEASED.
  • CONTRIBUTORS entry added, if necessary.
  • If it's relevant and worth mentioning, create a changelog entry for this change. The changelog entry will appear inside the UI for all users to see. To know if your change is worth the creation of a changelog entry, read the documentation.
  • Don't forget to ask for a free account on https://monicahq.com as anyone who contributes can request a free account.

@CLAassistant
Copy link

CLAassistant commented Jan 17, 2019

CLA assistant check
All committers have signed the CLA.

@parkr
Copy link
Author

parkr commented Jan 18, 2019

Signed the CLA! As a note, this is a personal contribution, not on behalf of my employer. 😄

@vladimino
Copy link

@parkr curious, why exactly 30?

@parkr
Copy link
Author

parkr commented Jan 20, 2019

@vladimino I chose 30 since each iteration sleeps for 1 second, and 30 seconds sounded reasonable for a timeout.

@asbiin asbiin merged commit 303f24f into monicahq:master Jan 24, 2019
@asbiin
Copy link
Member

asbiin commented Jan 24, 2019

@parkr nice work, thank you!

@github-actions
Copy link

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants