Entire App Blocking While Fetching Feed

41 views
Skip to first unread message

sandsfish

unread,
Jan 28, 2013, 10:20:30 AM1/28/13
to feed...@googlegroups.com
Hey guys and gals,

This is /possibly/ a more general Rails question, but I have a Rails 3 webapp that will fetch a feed when a user enters a URL, and when the feed takes a long time, or has issues, the whole app blocks until it returns or fails. How do you all handle these calls? Is there a best practice way to do these calls asynchronously so that it doesn't interfere with the rest of the web requests?

Any help would be much appreciated!

Thanks,
Sands

adam

unread,
Mar 5, 2013, 8:44:12 AM3/5/13
to feed...@googlegroups.com
You need to process the feed pulling in a process different to the one responsible for web requests. A common name for this is "background jobs" and there are plenty of gems to help you achieve this.

A good one to look at is Delayed Job. Thats usually enough for most people unless you have a lots to process in the background. 

For slightly more performance heavy stuff you also have (but not limited to)

resque and sidekiq which both use redis.

Checkout railscasts.com there are some videocasts explaining how such gems work.
Reply all
Reply to author
Forward
0 new messages