Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ActiveSupport.on_load to defer autoloaded Action Cable constants #391

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/lograge/rails_ext/action_cable/channel/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ def notification_payload(method_name)
end
end

ActionCable::Channel::Base.prepend(Lograge::ActionCable::ChannelInstrumentation)

ActiveSupport.on_load(:action_cable_channel) do
ActionCable::Channel::Base.prepend(Lograge::ActionCable::ChannelInstrumentation)
end
4 changes: 3 additions & 1 deletion lib/lograge/rails_ext/action_cable/connection/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ def notification_payload(method_name)
end
end

ActionCable::Connection::Base.prepend(Lograge::ActionCable::ConnectionInstrumentation)
ActiveSupport.on_load(:action_cable_connection) do
ActionCable::Connection::Base.prepend(Lograge::ActionCable::ConnectionInstrumentation)
end
12 changes: 7 additions & 5 deletions lib/lograge/rails_ext/action_cable/server/base.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true

module ActionCable
module Server
class Base
mattr_accessor :logger
self.logger = Lograge::SilentLogger.new(config.logger)
ActiveSupport.on_load(:action_cable) do
module ActionCable
module Server
class Base
mattr_accessor :logger
self.logger = Lograge::SilentLogger.new(config.logger)
end
end
end
end
Loading