Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed job for image uploads #123

Open
mattlebel opened this issue Oct 17, 2013 · 4 comments
Open

Delayed job for image uploads #123

mattlebel opened this issue Oct 17, 2013 · 4 comments

Comments

@mattlebel
Copy link
Contributor

Right now, there is the potential for image uploads to timeout (>30s to process) and cause an application error.

We should move the upload to a delayed job using this gem (https://github.com/jrgifford/delayed_paperclip/) or something similar. This introduces some dependencies, including Resque / Redis, but will increase the robustness of all uploads (images for now, possibly videos in the future).

Note that this fix would require running at least one worker dyno on your Heroku application to handle background tasks.

@msaint
Copy link
Contributor

msaint commented Oct 17, 2013

I think you'll find a number of tasks that are better suited for background jobs -- their addition to the crowdhoster app is inevitable. From what I've seen Sidekiq (https://github.com/mperham/sidekiq) is a very popular route to go.

For dealing with image uploads specifically, another option is to use what Crowdtilt uses - https://www.inkfilepicker.com/ - which completely bypasses the app to upload images directly to S3, then provides a url param interface for processing the image to whatever size you need. Pretty nice. But does introduce another 3rd party service dependency.

An alternative "DIY" way to achieve what Filepicker does would be to use something like this gem: https://github.com/dwilkie/carrierwave_direct

@mattlebel
Copy link
Contributor Author

@msaint Awesome alternatives here! There exists a Railscasts for Sidekiq as well: http://railscasts.com/episodes/366-sidekiq

@msaint
Copy link
Contributor

msaint commented Oct 17, 2013

yep :) you'll find an implementation of it (guided by that very railscast) on a little project called EntranceJams...

@msaint
Copy link
Contributor

msaint commented Jan 22, 2014

Been dabbling with Cloudinary lately for client side image uploads...pretty sweet and their free plan is incredibly generous and fully capable (in contrast to a service like Ink Filepicker, which is not so generous and won't even do conversions on the free plan). Given that Crowdhoster already has a few "freemium" dependencies, namely S3, it may be worth considering a switch over to Cloudinary for images and killing the S3 dependency altogether. Asset Sync is a rather fickle (and time consuming) gem, and Heroku (as well as amazon) no longer recommend treating S3 as a CDN. If the app by default simply served its own static assets, adding a real CDN like Cloudfront would be an almost trivial task, especially on Heroku with an add-on like CDN Sumo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants