Merge pull request #26620 from maclover7/jm-ac-pg-bug
Shutdown pubsub connection before classes are reloaded
This commit is contained in:
commit
4f8e336c44
@ -37,9 +37,13 @@ def restart
|
||||
connections.each(&:close)
|
||||
|
||||
@mutex.synchronize do
|
||||
worker_pool.halt if @worker_pool
|
||||
|
||||
# Shutdown the worker pool
|
||||
@worker_pool.halt if @worker_pool
|
||||
@worker_pool = nil
|
||||
|
||||
# Shutdown the pub/sub adapter
|
||||
@pubsub.shutdown if @pubsub
|
||||
@pubsub = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
33
actioncable/test/server/base_test.rb
Normal file
33
actioncable/test/server/base_test.rb
Normal file
@ -0,0 +1,33 @@
|
||||
require "test_helper"
|
||||
require "stubs/test_server"
|
||||
require "active_support/core_ext/hash/indifferent_access"
|
||||
|
||||
class BaseTest < ActiveSupport::TestCase
|
||||
def setup
|
||||
@server = ActionCable::Server::Base.new
|
||||
@server.config.cable = { adapter: "async" }.with_indifferent_access
|
||||
end
|
||||
|
||||
class FakeConnection
|
||||
def close
|
||||
end
|
||||
end
|
||||
|
||||
test "#restart closes all open connections" do
|
||||
conn = FakeConnection.new
|
||||
@server.add_connection(conn)
|
||||
|
||||
conn.expects(:close)
|
||||
@server.restart
|
||||
end
|
||||
|
||||
test "#restart shuts down worker pool" do
|
||||
@server.worker_pool.expects(:halt)
|
||||
@server.restart
|
||||
end
|
||||
|
||||
test "#restart shuts down pub/sub adapter" do
|
||||
@server.pubsub.expects(:shutdown)
|
||||
@server.restart
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user