Graceful Shutdown
If you're using event buffering (recommended), some events may still be in the internal queue when your process is about to exit. Call settle.destroy() during your shutdown sequence to flush them before the process terminates.
typescript
// In your app's startup/shutdown file
import { settle } from './lib/settle'
process.on('SIGTERM', async () => {
console.log('Flushing SettleSettle event buffer...')
await settle.destroy()
process.exit(0)
})
process.on('SIGINT', async () => {
await settle.destroy()
process.exit(0)
})Without this, any events still in the buffer when your process exits will be lost. This is especially important in serverless environments with short lifetimes.
