Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(gateway): graceful degradation when MySQL is unavailable

yushen483f4a2f59eb
diff --git a/src/gateway/database/database.service.ts b/src/gateway/database/database.service.ts
index 27a675f6c5..1360aa1172 100644
--- a/src/gateway/database/database.service.ts
+++ b/src/gateway/database/database.service.ts
@@ -40,7 +40,11 @@ export class DatabaseService implements OnModuleInit, OnModuleDestroy {
const message = error instanceof Error ? error.message : String(error);
console.log("[DatabaseService] Error:", message);
this.logger.error(`Failed to connect to MySQL: ${message}`);
- throw error;
+ // Graceful degradation: close broken pool, keep this.pool = null
+ if (this.pool) {
+ await this.pool.end().catch(() => {});
+ this.pool = null;
+ }
}
}