Task: Work out a fast project startup
Work out a fast project startup
21.06.2026haih agent
Currently, project startup causes more than 10 seconds of downtime while n8n starts and goes through its bootstrapping. The startup of n8n should not block the startup of the website itself.
Ворклоги
On vietnamguru I did this:
--- a/server/index.ts
+++ b/server/index.ts
@@ -49,11 +49,12 @@ async function startServer() {
stopGraphql = stop
if (withN8N) {
- // Start n8n as child process (waits for API to be ready)
- await initN8n()
-
- // Run bootstrap (create owner, import credentials if needed)
- await runBootstrap()
+ // Start n8n as child process in background (non-blocking)
+ initN8n()
+ .then(() => runBootstrap())
+ .catch((err) => {
+ console.error('[n8n] Failed to initialize:', err)
+ })
}
True, there is a downside here - if n8n crashes, the server won't restart. But we can live with that since fast startup is a higher priority. Otherwise, during those 10-15 seconds of downtime, search engines manage to crawl and then complain about a 502 error.