zombocom/rack-timeout

Setting timeout only in a occasion

MarcusPetri opened this issue · 1 comments

Is there a way to set a timeout value in a controller?

I dont want to use the gem in all my requests, I want to use only if I send a params in the request...

Something like:

class ApplicationController < ActionController::Base

  before_action :config_rack_timeout

  def config_rack_timeout
    if params[:use_timeout]
      Rails.application.config.middleware.insert_before Rack::Runtime, Rack::Timeout, service_timeout: 30
    end
  end
end

When I try to do this, I get the error: 'can't modify frozen Array'

Long debated feature. See #110 and many other past issues.