humanmade / humanmade/Cavalcade-Runner

Allow to wait some time before timeouting initial connection to the database

Open
#34 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
56
Forks
27
PR merge metrics
No merged PRs in 30d

Description

I'm running this in local docker environment and I'm hitting an error which says that database refuses connection:
```
web_1 | worker.1 | Error: SQLSTATE[HY000] [2002] Connection refused
web_1 | worker.1 | #0 /var/www/project/vendor/humanmade/cavalcade-runner/lib/Runner.php(200): PDO->__construct('mysql:host=mysq...', 'web', 'password', Array)
web_1 | worker.1 | #1 /var/www/project/vendor/humanmade/cavalcade-runner/lib/Runner.php(89): HM\Cavalcade\Runner\Runner->connect_to_db()
web_1 | worker.1 | #2 /var/www/project/vendor/humanmade/cavalcade-runner/bin/cavalcade(26): HM\Cavalcade\Runner\Runner->bootstrap('/var/www/projec...')
web_1 | worker.1 | #3 {main}
```
This happens because my mysql is not ready yet. Could we add a default timeout which could be adjusted with an flag like `--timeout=10`?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/Runner.php, especially connect_to_db(), and the bin/cavalcade entry point shown in the stack trace. Trace how the initial PDO connection is made and determine how the requested --timeout=10 option would be passed through. Done means startup can wait for a delayed MySQL connection using an adjustable default timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.