vigour-io / shutter

Makes a sprite out of an array of urls
ISC License
1 stars 0 forks source link

Close request socket before serving result #8

Open shawninder opened 9 years ago

shawninder commented 9 years ago

There are HTTP headers for this stuff

The idea here is not to keep sockets open while doing the (potentially long) process of transforming an image.

shawninder commented 9 years ago

This might be harder than expected because we can't guarantee all webviews and browsers will react the same way to non-200 responses, and we can't make all requests ourselves, e.g. image tags, css urls

For example, if we use 503 and a retry-after header to have the browser retry when the manipulation is finished, we can't guarantee every client will actually respect this and retry...

The only solution seems to be to delegate the waiting to a different service: the image server would respond with a redirect header to a different service which just keeps the socket open until the image server tells it that the resource is ready, at which point it responds with a redirect to that resource on the image server.. This seems really cracky and we can still not guarantee every browser will follow the redirects.

Conclusion, I'm putting this one on the back burner for now (because the image server has never yet crashed because of too many opened sockets).