zombocom/rack-timeout

Request: timeout exempt requests

latortuga opened this issue · 1 comments

Hi there, love the gem.

I have a system in place that allows me to push specific kinds of requests to a background job process which ultimately runs the request through my Rails app in the background. In those circumstances, I basically have a request that is going through my app, but it is not time-sensitive - the whole point of this setup is to push slow requests to a background job for processing. The frontend can show a spinner while it waits for the worker to finish the slow request and can give the user periodic updates about the progress.

I would like to exempt these "backgrounded" requests from timeouts. Currently, there doesn't seem to be a way to exempt anything from timeouts. If it happens in the app where the middleware is mounted, it is subject to timeout.

Any chance of something like this could get implemented? I'm envisioning something super basic like:

env["rack.timeout.exempt"] = true

There's been many requests and several PRs over the years to be able to do this or something similar. The general conclusion has been this is an anti-pattern. The most vigorous debate took place in #110, which I welcome you to review.

I think if we can find a sustainable approach that allows people to customize the behavior, but does not endlessly add more options/option handling, then this might have a future. However, this might require significant refactoring.

In this case I am going to suggest merging any further discussion of this issue into #213. Thanks!