News for hackers. Stuff that matters.
Re:Go and SQLite Best Practices by ncruces on Monday August 25, 2025 @03:28PM (#45017915)
> Seems like the ideal thing is to spawn a goroutine and run optimize periodically. Many Go daemons I run will have uptime measured in months so running on shutdown isn't super useful there.

Connections don't necessarily need to be kept forever. Between SetConnMaxLifetime/SetConnMaxIdleTime that's one way of periodically optimizing from “warm” connections. But doing it on a timer from a fresh goroutine is another.

Re:Go and SQLite Best Practices by jacob2161 on Monday August 25, 2025 @04:03PM (#45018324)
That's a good point too. It seems a bit weird to me to garbage collect connections that I know I'll just recreate in most cases, especially when they're so cheap and limited in number.

Cycling connections may cover for certain classes of bugs but I dislike doing things for this reason, but maybe there are others. I'll put some thinking/testing into it at some point.

Thanks!