add retry to platform.start instead

this is because it holds a lock and cannot be re-tried

See also 0c0aeeae4c which tried to
make it for all startup tasks
This commit is contained in:
Girish Ramakrishnan
2021-11-02 22:30:38 -07:00
parent 4ffe03553a
commit af2a8ba07f
2 changed files with 24 additions and 20 deletions

View File

@@ -152,16 +152,8 @@ async function runStartupTasks() {
// we used to run tasks in parallel but simultaneous nginx reloads was causing issues
for (let i = 0; i < tasks.length; i++) {
for (let attempt = 0; attempt < 3; attempt++) {
const [error] = await safe(tasks[i]());
if (!error) break; // task succeeded
debug(`Startup task at index ${i} failed (attempt ${attempt}): ${error.message}`);
// for some reason, mysql arbitrary restarts making startup tasks fail. this makes the box update stuck
const retry = error.reason === BoxError.DATABASE_ERROR && error.code === 'PROTOCOL_CONNECTION_LOST';
if (!retry) break;
debug(`Will retry task at index ${i}`);
await delay(3000);
}
const [error] = await safe(tasks[i]());
if (error) debug(`Startup task at index ${i} failed: ${error.message}`);
}
}