Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting timeout only in a occasion #138

Closed
MarcusPetri opened this issue Aug 2, 2018 · 1 comment
Closed

Setting timeout only in a occasion #138

MarcusPetri opened this issue Aug 2, 2018 · 1 comment

Comments

@MarcusPetri
Copy link

MarcusPetri commented Aug 2, 2018

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'

@wuputah
Copy link
Collaborator

wuputah commented Aug 2, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants