-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Retry database reset a few times to allow time for it to come online. #9333
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
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
141e0d6 to
8826fad
Compare
Silly. Quite silly. that will never work.
9d15bb9 to
8d5d3f7
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
johnbillion
left a comment
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 got thoroughly fed up of these database connection errors in the test suites for my plugins so I ended up with a comprehensive wait mechanism: https://github.com/johnbillion/plugin-infrastructure/blob/313e0b6ef3da09aefec813d6f6c619a2f0af40c9/bin/acceptance-tests#L30-L38 . If we could translate that into node it would be a solid solution.
| if ( retries > 0 ) { | ||
| console.warn( `Retrying command "${cmd}" (${retries} retries left)...` ); | ||
| // Wait a bit before retrying. | ||
| setTimeout( () => {}, 1000 ); |
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.
setTimeout() delays the execution of its callback, not the code that follows it, so this doesn't delay anything.
|
Thanks for taking a look John. I've realized this is the wrong approach. The docker file already has a |
This is an attempt to recover if the database server hasn't completed booting when the web server starts.
If the
wp db resetcommand fails, it will be retried a number of times to ensure that the error is permanent rather than temporary.On the test suite, I've been seeing a lot of failures that are seemingly caused by a race condition rather than an error when docker is started. As a case in point, see this action run.
I've not seen any such errors with this code but that may be dumb luck rather than anything I've fixed.
Trac ticket: https://core.trac.wordpress.org/ticket/63167
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.