Skip to content

Commit 47b2ae2

Browse files
committed
debugging this problem
1 parent f8dffe9 commit 47b2ae2

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

ruby/hyper-model/lib/active_record_base.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def do_not_synchronize?
291291
after_commit :synchromesh_after_destroy, on: [:destroy]
292292

293293
def synchromesh_after_create
294+
puts "synchromesh_after_create: #{do_not_synchronize?} channels: #{Hyperstack::Connection.active}" if Hyperstack::Connection.show_diagnostics
294295
return if do_not_synchronize?
295296
ReactiveRecord::Broadcast.after_commit :create, self
296297
end

ruby/hyper-model/lib/reactive_record/broadcast.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ def self.after_commit(operation, model)
66
# before the first broadcast.
77
@public_columns_hash ||= ActiveRecord::Base.public_columns_hash
88
Hyperstack::InternalPolicy.regulate_broadcast(model) do |data|
9+
puts "Broadcast aftercommit hook: #{data}" if Hyperstack::Connection.show_diagnostics
10+
911
if !Hyperstack.on_server? && Hyperstack::Connection.root_path
1012
send_to_server(operation, data) rescue nil # fails if server no longer running so ignore
1113
else

ruby/hyper-model/spec/batch7/poly_assoc_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ class Testing123 < HyperComponent
301301
end
302302

303303
it 'creates due to a broadcast client side' do
304-
wait_for_ajax # so pusher can initialize
304+
Hyperstack::Connection.show_diagnostics = true
305+
# wait_for_ajax # so pusher can initialize
306+
# sleep 1
305307
@uzer1.groups << @group1
306308
compare_to_server @group1, 'uzers.collect(&:id)', [@uzer1.id], false
307309
end

ruby/hyper-operation/lib/hyper-operation/transport/connection.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def transport
100100

101101
class << self
102102
attr_accessor :transport
103+
attr_accessor :show_diagnostics
103104

104105
def active
105106
# if table doesn't exist then we are either calling from within
@@ -114,8 +115,9 @@ def active
114115
end
115116

116117
def open(channel, session = nil, root_path = nil)
118+
puts "open(#{channel}, #{session}, #{root_path})" if show_diagnostics
117119
self.root_path = root_path
118-
find_or_create_by(channel: channel, session: session)
120+
find_or_create_by(channel: channel, session: session).tap { |c| puts " - open returning #{c}" if show_diagnostics}
119121
end
120122

121123
def send_to_channel(channel, data)
@@ -133,6 +135,7 @@ def read(session, root_path)
133135
end
134136

135137
def connect_to_transport(channel, session, root_path)
138+
puts "connect_to_transport(#{channel}, #{session}, #{root_path})" if show_diagnostics
136139
self.root_path = root_path
137140
if (connection = find_by(channel: channel, session: session))
138141
messages = connection.messages.pluck(:data)

0 commit comments

Comments
 (0)