* make dynamic registrations confgurable, in case server crashes again: VRFS-2645
This commit is contained in:
parent
65f1f0fe79
commit
8556aaac13
|
|
@ -535,8 +535,10 @@
|
|||
var $box = $(box)
|
||||
$mountState = $box.find('.listen-broadcast-state')
|
||||
|
||||
updateMountInfo(mountInfo)
|
||||
updateMountDetails(mountInfo);
|
||||
if(mountInfo) {
|
||||
updateMountInfo(mountInfo)
|
||||
updateMountDetails(mountInfo);
|
||||
}
|
||||
}
|
||||
|
||||
function updateMountInfo(mount) {
|
||||
|
|
|
|||
|
|
@ -72,5 +72,6 @@ Server.new.run(:port => config["port"] + (jam_instance-1 ) * 2,
|
|||
:influxdb_password => config['influxdb_password'],
|
||||
:influxdb_hosts => config['influxdb_hosts'],
|
||||
:influxdb_port => config['influxdb_port'],
|
||||
:allow_dynamic_registration => config['allow_dynamic_registration'],
|
||||
:cidr => config['cidr'],
|
||||
:gateway_name => gateway_name)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ Defaults: &defaults
|
|||
influxdb_password: "root"
|
||||
influxdb_hosts: ["localhost"]
|
||||
influxdb_port: 8086
|
||||
allow_dynamic_registration: true
|
||||
|
||||
development:
|
||||
port: 6767
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ module JamWebsockets
|
|||
@disconnected_count = 0
|
||||
end
|
||||
|
||||
def start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, options={:host => "localhost", :port => 5672, :max_connections_per_user => 10, :gateway => 'default'}, &block)
|
||||
def start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, options={:host => "localhost", :port => 5672, :max_connections_per_user => 10, :gateway => 'default', :allow_dynamic_registration => true}, &block)
|
||||
|
||||
@log.info "startup"
|
||||
|
||||
|
|
@ -73,6 +73,7 @@ module JamWebsockets
|
|||
@connect_time_expire_browser = connect_time_expire_browser
|
||||
@max_connections_per_user = options[:max_connections_per_user]
|
||||
@gateway_name = options[:gateway]
|
||||
@allow_dynamic_registration = options[:allow_dynamic_registration]
|
||||
|
||||
begin
|
||||
@amqp_connection_manager = AmqpConnectionManager.new(true, 4, :host => options[:host], :port => options[:port])
|
||||
|
|
@ -327,7 +328,9 @@ module JamWebsockets
|
|||
|
||||
if clients.length == 0
|
||||
# if there are no more clients listening, then unsubscribe to the topic for this mount_id
|
||||
@subscription_topic.unbind(@subscriptions_exchange, :routing_key => "subscription.#{type}.#{id}")
|
||||
routing_key = "subscription.#{type}.#{id}"
|
||||
@log.debug("unregister dynamic topic #{routing_key}")
|
||||
@subscription_topic.unbind(@subscriptions_exchange, :routing_key => routing_key)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -804,7 +807,7 @@ module JamWebsockets
|
|||
id = subscribe.id
|
||||
type = subscribe.type
|
||||
if id && id.length > 0 && type && type.length > 0
|
||||
#register_subscription(client, type, id)
|
||||
register_subscription(client, type, id) if @allow_dynamic_registration
|
||||
else
|
||||
@log.error("handle_subscribe: empty data #{subscribe}")
|
||||
end
|
||||
|
|
@ -814,7 +817,7 @@ module JamWebsockets
|
|||
id = unsubscribe.id
|
||||
type = unsubscribe.type
|
||||
if id && id.length > 0 && type && type.length > 0
|
||||
#unregister_subscription(client, type, id)
|
||||
unregister_subscription(client, type, id) if @allow_dynamic_registration
|
||||
else
|
||||
@log.error("handle_subscribe: empty data #{unsubscribe}")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ module JamWebsockets
|
|||
gateway_name = options[:gateway_name]
|
||||
rabbitmq_host = options[:rabbitmq_host]
|
||||
rabbitmq_port = options[:rabbitmq_port].to_i
|
||||
allow_dynamic_registration = options[:allow_dynamic_registration].nil? ? true : options[:allow_dynamic_registration]
|
||||
|
||||
Stats::init(options)
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ module JamWebsockets
|
|||
}
|
||||
|
||||
EventMachine.run do
|
||||
@router.start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, host: rabbitmq_host, port: rabbitmq_port, max_connections_per_user: max_connections_per_user, gateway: gateway_name) do
|
||||
@router.start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, host: rabbitmq_host, port: rabbitmq_port, max_connections_per_user: max_connections_per_user, gateway: gateway_name, allow_dynamic_registration: allow_dynamic_registration) do
|
||||
start_connection_expiration
|
||||
start_client_expiration
|
||||
start_connection_flagger
|
||||
|
|
|
|||
Loading…
Reference in New Issue