mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
feat(storage): add shared R2 media proxy and orphan cleanup tooling for R2/Bunny
This commit is contained in:
@@ -77,17 +77,19 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
globalForPrisma.prisma = db;
|
||||
}
|
||||
|
||||
export async function disconnectDb(): Promise<void> {
|
||||
if (globalForPool.pgPool) {
|
||||
await globalForPool.pgPool.end();
|
||||
globalForPool.pgPool = undefined;
|
||||
}
|
||||
await db.$disconnect();
|
||||
}
|
||||
|
||||
// Graceful shutdown handler
|
||||
async function shutdown() {
|
||||
console.log('Shutting down database connections...');
|
||||
|
||||
if (globalForPool.pgPool) {
|
||||
await globalForPool.pgPool.end();
|
||||
console.log('Database pool closed');
|
||||
}
|
||||
|
||||
await db.$disconnect();
|
||||
console.log('Prisma client disconnected');
|
||||
await disconnectDb();
|
||||
console.log('Database connections closed');
|
||||
}
|
||||
|
||||
// Register shutdown handlers
|
||||
|
||||
Reference in New Issue
Block a user