propershark / shark

An event publisher for realtime transit information.
3 stars 0 forks source link

Add heartbeat frequencies to WAMP Events and RPCs page #25

Closed elliottwilliams closed 8 years ago

elliottwilliams commented 8 years ago

So that it's possible see how often a heartbeat is emitted. This is particularly good to know for objects like routes, which have huge (~32kb) JSON representations.

faultyserver commented 8 years ago

We can definitely add defaults, though the actual frequencies are configurable. Ex:

# config/citybus.rb
Shark::Agency.configure do |agency|
  agency.use_manager :route_manager do |manager|
    manager.object_type       = Shark::Route
    manager.update_frequency  = '4h'

    # Route information comes from DoubleMap and CityBus
    manager.source_from :doublemap
    manager.source_from :tripspark
  end
  ...
end

The update_frequency = '4h' is used to schedule update cycles for that manager, which is responsible for firing pretty much every event; in this case it's every 4 hours.

The current configuration for citybus is pretty much pulled out of thin air, but the times are:

For defaults, I think Vehicles should be lowered to every 5 seconds, which would reduce total network traffic by more than half. Other than that, these values should work, but there's no real rationale for them.

faultyserver commented 8 years ago

I've added "defaults" to the wiki with the above frequencies (with vehicles lowered from 2s to 5s).