diff --git a/ruby/lib/jam_ruby/recurly_client.rb b/ruby/lib/jam_ruby/recurly_client.rb index 5b0a8262d..1accc1246 100644 --- a/ruby/lib/jam_ruby/recurly_client.rb +++ b/ruby/lib/jam_ruby/recurly_client.rb @@ -94,7 +94,12 @@ module JamRuby def get_account(current_user) - account = current_user && current_user.recurly_code ? Recurly::Account.find(current_user.recurly_code) : nil + begin + account = current_user && current_user.recurly_code ? Recurly::Account.find(current_user.recurly_code) : nil + rescue Recurly::Error => x + puts "Swallow find acct for user #{current_user.email} error initial #{x}" + end + # check again, assuming account_code is the user ID (can happen in error scenarios where we create the account # on recurly, but couldn't save the account_code to the user.recurly_code field) @@ -103,7 +108,7 @@ module JamRuby begin account = Recurly::Account.find(current_user.id) rescue Recurly::Error => x - puts "Swallow find acct error #{x}" + puts "Swallow find acct for user #{current_user.email} error #{x}" end # repair user local account info diff --git a/websocket-gateway/lib/jam_websockets/router.rb b/websocket-gateway/lib/jam_websockets/router.rb index 5fb2865b6..fbb2b70dd 100644 --- a/websocket-gateway/lib/jam_websockets/router.rb +++ b/websocket-gateway/lib/jam_websockets/router.rb @@ -1455,8 +1455,9 @@ module JamWebsockets def wipe_all_connections # meant to be called only on startup; delete all connections fo myself - ConnectionManager.active_record_transaction do |connection_manager| + ConnectionManager.active_record_transaction do |connection_manager, conn| clients = connection_manager.connection_client_ids_for_gateway(@gateway_name) + @log.info "Cleaning up #{clients.length} clients on startup" clients.each do |client_id| cleanup_client_with_id(client_id) end diff --git a/websocket-gateway/lib/jam_websockets/server.rb b/websocket-gateway/lib/jam_websockets/server.rb index 6b2d8a116..65e8520e3 100644 --- a/websocket-gateway/lib/jam_websockets/server.rb +++ b/websocket-gateway/lib/jam_websockets/server.rb @@ -38,8 +38,6 @@ module JamWebsockets @log.info "starting server #{host}:#{port} staleness_time=#{connect_time_stale_client}; reconnect time = #{connect_time_expire_client}, rabbitmq=#{rabbitmq_host}:#{rabbitmq_port} gateway_name=#{gateway_name}" - @router.init - EventMachine.error_handler{|e| puts "unhandled error #{e}" puts "unhandled error #{e.backtrace}" @@ -51,6 +49,8 @@ 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, allow_dynamic_registration: allow_dynamic_registration, chat_enabled: chat_enabled, chat_blast: chat_blast) do + @router.init + #start_connection_expiration #start_client_expiration #start_connection_flagger