Browse Source

instrumentalizer no more global variable

main
pvincent 2 months ago
parent
commit
af7088788a
  1. 2
      config/initializers/instrumentalizing.rb
  2. 1
      lib/live/definable.rb
  3. 8
      lib/semantic/instrumentalizer.rb

2
config/initializers/instrumentalizing.rb

@ -1,5 +1,3 @@
return if Rails.application.tailwind_watcher?
return unless Rails.application.server? return unless Rails.application.server?
if Rails.env.development? if Rails.env.development?

1
lib/live/definable.rb

@ -1,5 +1,6 @@
require 'dotenv' require 'dotenv'
# FIXME: do not use global variable
$definable_thread_group ||= ThreadGroup.new $definable_thread_group ||= ThreadGroup.new
module Live module Live

8
lib/semantic/instrumentalizer.rb

@ -16,10 +16,14 @@ module Semantic
private private
def global_subscribers = $global_subscribers ||= [] # rubocop:disable Style/GlobalVars
def global_subscribers
@global_subscribers ||= []
end
def reset def reset
global_subscribers.each { |sub| ActiveSupport::Notifications.unsubscribe(sub) }
global_subscribers.each do |sub|
ActiveSupport::Notifications.unsubscribe(sub)
end
global_subscribers.clear global_subscribers.clear
NOTIFICATIONS.each do |event_group, hooks| NOTIFICATIONS.each do |event_group, hooks|

Loading…
Cancel
Save