ruby-hyperloop / hyper-mesh

The project has moved to Hyperstack!! - Synchronization of active record models across multiple clients using Pusher, ActionCable, or Polling
https://hyperstack.org/
MIT License
22 stars 12 forks source link

performance: tests failing for exception guard in server_data_cache #44

Closed janbiedermann closed 6 years ago

janbiedermann commented 6 years ago

for performance for cache misses and non existent records we guard the call that would cause an exception otherwise in server_data_cache.rb, around line 195. Original:

                  begin
                    cache_item.build_new_cache_item(cache_item.value.send(*method), method, method)
                  rescue Exception => e
                    if cache_item.value and cache_item.value != []
                      ReactiveRecord::Pry::rescued(e)
                      raise e, "ReactiveRecord exception caught when applying #{method} to db object #{cache_item.value}: #{e}", e.backtrace
                    else
                      representative
                    end
                  end

Guarded:

                 if cache_item.value.nil? || cache_item.value == []
                    representative
                  else
                    begin
                      cache_item.build_new_cache_item(cache_item.value.send(*method), method, method)
                    rescue Exception => e
                      ReactiveRecord::Pry::rescued(e)
                      raise e, "ReactiveRecord exception caught when applying #{method} to db object #{cache_item.value}: #{e}", e.backtrace
                    end
                  end

This guard makes the following tests fail: rspec ./spec/batch4/scope_spec.rb:67 # synchronized scopes will be updated only when needed rspec ./spec/batch4/scope_spec.rb:169 # synchronized scopes scopes with params can be nested rspec ./spec/batch4/scope_spec.rb:258 # synchronized scopes can have a client filter method rspec ./spec/batch4/scope_spec.rb:371 # synchronized scopes client side scoping methods can take args rspec ./spec/batch4/scope_spec.rb:494 # synchronized scopes the joins option can join with all or no models

Should be fixed for 0.15

janbiedermann commented 6 years ago

fixed in lap11