News for hackers. Stuff that matters.
Re:Rails adds support for Fiber-safe ActiveRecord Connection... by dnautics on Thursday February 24, 2022 @09:52AM (#30455370)
For starters, phoenix has had "support" for the equivalent of fiber-safe database connection pools forever, and it's advanced enough that you can concurrently run tests that checkout database "sandbox" transactions and you can spawn a task off it "that runs in another fiber" which will still know which database sandbox to use and with about 10LOC you can make it so your integration test can issue an http request to the server and the "fiber" that handles the request operates in the same sandbox. Oh, and this pattern is part of the standard library so it will work with just about any other thing that needs to share global state (like mocks), not just databases.

There are no comments on this comment yet.