独角兽+ Rails +大型上传 [英] Unicorn + Rails + Large Uploads

查看:132
本文介绍了独角兽+ Rails +大型上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在使用Rails在Heroku上运行Unicorn时允许大量上传,但我意识到任何大型上传可能需要比独角兽工作者的超时更长的时间。这意味着(我见过这种情况)Unicorn主进程会杀死上载大文件的工作者,并且请求将超时(发生503错误)。



如果没有删除或大量增加服务器的超时时间,有什么办法可以让上传工作者在上传完成时挂起?或者,我是否完全误解,并且最有可能导致我的上传超时?

到S3,那么你可以简单地让用户直接上传文件到S3,而不是通过你的dynos,并在上传完成时进行ping。



信息比这个,看看像 CarrierWaveDirect


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 Unicorn worker. This will mean (I've seen this happen) that the Unicorn master process will kill the worker uploading the large file and the request will timeout (with a 503 error).

Without removing or massively increasing the timeout for my server is there any way to allow the uploading worker to hang while the upload completes? Or, am I completely misunderstanding and its most likely something else that is causing my uploads to timeout?

解决方案

If you're uploading to S3, then you can "simply" have the user upload files direct to S3 instead of via your dynos, and get pinged when the upload is complete.

For significantly more information than this, check out something like CarrierWaveDirect

这篇关于独角兽+ Rails +大型上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆