import { db } from '@/server/db' export default () => { if (import.meta.dev) return let exiting = false const shutdown = async () => { if (exiting) { process.exit(0) } exiting = true setTimeout(async () => { await db.$client.end() process.exit(0) }, 500) } process.on('SIGINT', shutdown) process.on('SIGTERM', shutdown) }