mirror of https://github.com/rails/rails
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:
parent
3694e16335
commit
601e3d0c4f
|
@ -7,9 +7,6 @@ module ActiveRecord
|
|||
def active?
|
||||
true
|
||||
end
|
||||
|
||||
def finalize
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue