J
J
justed_ss2015-11-25 15:39:08
Ruby on Rails
justed_ss, 2015-11-25 15:39:08

How to fix rails faye thin memory leaks?

Rails 4.1.4 ruby ​​2.2
Faye controller looks like this

class RealAppointmentsController < FayeRails::Controller
end

Mounted like this
config.middleware.delete Rack::Lock
config.middleware.use FayeRails::Middleware, mount: '/faye', :timeout => 25 do
   map '/appointments' => RealAppointmentsController
   map :default => :block
end

Used as SSE, because all implementations of SSE on rails look like mountains of crutches.
Called from standard controller methods like this
RealAppointmentsController.publish('/appointments', @appointment.to_json)

If possible, in the right places, the subscription is canceled on the client through
subscription.cancel();
And nevertheless, the server eats off 5-15 MB from the system for each client. Even taking into account the fact that ruby ​​does not return the occupied memory to the system, sooner or later it must stop taking memory from the system, but this does not happen. Those. in development with one client and a bunch of page updates, it systematically eats up all the memory.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question