rails/rails — Issue #4411: render :status => ... dramatic delay (1.2 min)
Author: pmeinhardt
Created: 2012-01-11 14:53:47+00:00
State: open

Hey, I've just spent a day searching for a hard bug.
It wasn't noticeable in my local environment, but on the production server!

Here's the code (from a controller):

def create
draft = Draft.new(params)
if draft.save
json draft, 201
else
...
end
end

The corresponding `json` method:

def json(obj, code = 200)
render :json => obj, :status => code
end

*The client gets the 201 immediately, but the response body is only downloaded 70-90 seconds later.
If I **remove the 201 or even pass a 200 everything is fine**.*

So `json draft #, 201` or even `json draft, 200` are fine.

Does everyone else just use 200 for RESTful object creation or why hasn't this occured earlier?

Regards,
Paul