Skip to content

fix: 增强数据库启动容错,解决重启后 ECONNREFUSED 和 57P01 crash#6

Open
shanaiardor wants to merge 1 commit into
FFatTiger:mainfrom
shanaiardor:fix/db-startup-resilience
Open

fix: 增强数据库启动容错,解决重启后 ECONNREFUSED 和 57P01 crash#6
shanaiardor wants to merge 1 commit into
FFatTiger:mainfrom
shanaiardor:fix/db-startup-resilience

Conversation

@shanaiardor

Copy link
Copy Markdown

三层防御:

  • db.ts: pg.Pool 增加 idle-error 监听器,避免数据库重启导致 uncaughtException
  • migrations.ts: runMigrations 前等待数据库就绪,自动重试临时性连接错误
  • docker-compose: Postgres healthcheck 增加 start_period 和更多 retries,修复 DATABASE_URL 默认值硬编码问题

 三层防御:
 - db.ts: pg.Pool 增加 idle-error 监听器,避免数据库重启导致 uncaughtException
 - migrations.ts: runMigrations 前等待数据库就绪,自动重试临时性连接错误
 - docker-compose: Postgres healthcheck 增加 start_period 和更多 retries,修复 DATABASE_URL 默认值硬编码问题
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant