Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hopefully takes care of #164.
There are 3 significant changes in this PR:
1. Remove
lock_thread
on connection poolThe commit that added
lock_thread
(f638085) notes thatThe commit that adds
lock_thread
in Rails has some helpful context:So
lock_thread
exists because there are two different threads — Puma and Capybara — trying to access the same database but not necessarily seeing the same thing. But! cypress-rails doesn't use Capybara, and more importantly, it doesn't use tests or a test runner written in Ruby at all, so there's only one thread trying to use the database. So we don't need all this thread locking stuff. So let's remove it to make things more compatible with Rails 7.2. Hat tip to @tinney for saying this to my face before I came around to it. 😅I think I'm right about this, but I plan to do a pre-release with these changes and try to get some folks from #164 to do real world testing.
(Aside for breadcrumbs, the commits that remove
lock_thread
are rails/rails@26de25d and rails/rails@1dcb411.)2. Use
#lease_connection
instead of#connection
(when available)This change is ripped straight from #165, so thank you to @ledermann! 🙇
3. Build and test the example app with both Rails 7.1 and 7.2
Rails 7.1 is still supported, and I wouldn't be surprised if we end up with 3 simultaneously supported versions at some point: 7.1, 7.2, and 8.0. I'd like the tests to cover all versions we support so that we can feel more confident in changes.
I went about this with symlinked Gemfiles (hat tip to @jasonkarns on this one) with some logic in
Gemfile
to do the right Rails version, paired with some use ofBUNDLE_GEMFILE
.