Remove `finalize` from NullSession

`finalize_session` should not be able to be called if a session has not
been started, we should never have a `NullSession` when we get there. So
we can remove the guard altogether to help make it obvious if this sort
of thing does happen when it's not supposed to.
This commit is contained in:
Lee Quarella 2021-02-18 15:08:13 -05:00
parent 3694e16335
commit 601e3d0c4f
2 changed files with 0 additions and 17 deletions

View File

@ -7,9 +7,6 @@ module ActiveRecord
def active?
true
end
def finalize
end
end
end

View File

@ -408,20 +408,6 @@ module ActiveRecord
ensure
ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber
end
def test_async_query_finalize_with_null_session
assert_nothing_raised do
@connection.select_all "SELECT * FROM posts", async: true
end
@connection.transaction do
assert_raises AsynchronousQueryInsideTransactionError do
@connection.select_all "SELECT * FROM posts", async: true
end
end
ensure
ActiveRecord::Base.asynchronous_queries_tracker.finalize_session
end
end
class AsynchronousQueriesTest < ActiveRecord::TestCase