OptionalenabledEnable or disable write batching.
OptionaltimeFlush interval in milliseconds.
OptionalautoLet the circuit breaker re-arm itself on a timer after an outage: once recoverAfter is up,
one trial flush decides whether the database is back.
Set false to switch off that timed self-heal => the breaker then stays tripped until the
process restarts (the pre-recovery behaviour), only worth it if you'd rather a supervisor
replace the process than have it heal in place. Note this disables the automatic, interval
driven recovery path only: a flush that succeeds for any other reason still closes the
breaker, so the drain on close() or on shutdown can clear it as a side effect of getting
your last writes out.
OptionalrecoverHow long to stay in read-only mode before attempting a trial flush, in milliseconds.
OptionalflushDrain the buffer when the process is going away => SIGINT, SIGTERM & beforeExit.
Containers stop processes with SIGTERM, so without this a deploy or a scale down silently
loses up to one flush interval of writes. The handler flushes, takes itself off & re-raises the
signal, so the app's own shutdown still runs => the library never calls process.exit() for
you. Hard kills (SIGKILL) can't be caught by anyone, that window stays lost.
Set false if your app owns shutdown & already calls await db.close() (which flushes too),
or if you don't want a library holding signal listeners at all.
OptionalhooksObservability callbacks. See CollectorHooks.
Controls write collector behaviour. The collector batches writes in RAM and flushes to the DB in bulk at each interval.