feat: Disable wal_autocheckpoint
We should consider scheduling housekeeping() after program start, this way the user can trigger WAL checkpointing also. housekeeping() is scheduled after deletion of messages and chats, but this isn't a convenient and obvious way to trigger it.
Also w/o WAL autocheckpointing there's another interesting option: we can disable running wal_checkpoint for some time at all, e.g. after a version upgrade and this way provide a way to roll back the upgrade by truncating the WAL. This is worse than a normal backup of course because after such a restoration some referenced blobs may be missing.
I am not sure how many pages we accumulate during the day. I'm afraid we will grow a huge unlimited WAL in some workloads, e.g. for a bot that receives a lot of messages and normally deletes them almost immediately.
It seems correct way is to register our own WAL hook (https://sqlite.org/c3ref/wal_hook.html) that notifies a separate thread to do manual checkpointing via channel when WAL grows too large. And just have this thread/task constantly waiting in for notification and then taking all the connections and doing checkpointing just like it is currently done in housekeeping. It is possible to register a hook via https://docs.rs/rusqlite/0.37.0/rusqlite/struct.Connection.html#method.wal_hook, it also unregisters autocheckpointing.
If a bot deletes messages or chats, delete_msgs_locally_done() triggers housekeeping, so the WAL shouldn't grow a lot. But i agree that it makes sense to register our own WAL hook to make sure we don't miss another scenario.
rusqlite::Connection::wal_hook() isn't really useful because it takes fn, so not much we can do there. But overall i think it's simpler to run wal_checkpoint() from inbox_loop() than trying to solve this with a hook and a separate thread/task listening to events.