Unicorn + Rails + Large Uploads

后端 未结 2 1123
慢半拍i
慢半拍i 2021-02-08 04:38

I\'m trying to allow for large uploads when running Unicorn on Heroku with Rails but I\'ve realised that any large uploads might take longer than the timeout period for a Unicor

2条回答
  •  深忆病人
    2021-02-08 04:57

    If you're using nginx as a reverse proxy in front of your unicorns, you can use the Upload Module. When configured, nginx handles the upload and stores it in a /tmp directory, then your unicorn gets request params telling it where the uploaded asset is and it's content type. No more worker tied up receiving the upload.

    If you don't really want the upload on the same server as your web service, but rather store it in S3, you should follow @Neil Middleton's suggestion and set things up so the upload goes directly there.

提交回复
热议问题