Detect non-atomic interactions within DB transactions.
Examples:
# HTTP calls within transaction
User.transaction do
user = User.new(user_params)
user.save!
# HTTP API call
PaymentsService.charge!(user)
end
#=> raises Isolator::HTTPError
# background job
User.transaction do
user.update!(confirmed_at: Time.now)
UserMailer.successful_confirmation(user).deliver_later
end
#=> raises Isolator::BackgroundJobError
Add this line to your application's Gemfile:
group :development, :test do
gem "isolator"
end
TBD
Bug reports and pull requests are welcome on GitHub at https://github.com/palkan/isolator.
The gem is available as open source under the terms of the MIT License.