News for hackers. Stuff that matters.
Re:Rust – How do I create a global, mutable singleton? (2015) by bluejekyll on Wednesday July 22, 2020 @11:11AM (#23917858)
To quote myself, “it should be avoided”, doesn’t mean never.

DB connections as global state, I might go as far as saying global for a single thread, ie it might be reasonable to have a thread-local-storage for checked out connections. I still would keep access to that thread-local restricted, and keep most of the code more testable by having the connection be a parameter to each function.

There are no comments on this comment yet.