Update MySQL handler to add timeout for DNS query failures

Signed-off-by: Michael Irwin <mikesir87@gmail.com>

I was helping troubleshoot an issue with someone, who ended up
having a typo in their compose file where the MySQL service was
using the name "msyql", which obviously causes DNS to fail. But,
since the db init doesn't time out, it just looks hung. This fixes
that.
This commit is contained in:
Michael Irwin 2022-12-13 16:53:36 -05:00
Родитель b4d6426abc
Коммит 8dff10bcaa
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 8C42FBB0E482C8CF
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -21,7 +21,12 @@ async function init() {
const password = PASSWORD_FILE ? fs.readFileSync(PASSWORD_FILE) : PASSWORD;
const database = DB_FILE ? fs.readFileSync(DB_FILE) : DB;
await waitPort({ host, port : 3306});
await waitPort({
host,
port: 3306,
timeout: 10000,
waitForDns: true,
});
pool = mysql.createPool({
connectionLimit: 5,