Non blocking http request

Any one know if it is possible to do a non-blocking http request within Ror?

I looked at Net::HTTP, nothing obvious.

In my code, I want to fire off a http request (and not care about the return or wait for it) and continue with the rest of the work. I know I can use backgroundrb etc - but that seems an overkill.

Any help appreciated.

thanks.

Seriously, checkout delayed_job. It’s super easy to implement, and is anything but overkill. Here’s the URL for the project:

http://github.com/collectiveidea/delayed_job

… and as an added bonus, Ryan Bates covers it in a Railscast. Here’s the URL for the Railscast:

http://railscasts.com/episodes/171-delayed-job

Cheers,

Tim

I agree with Tim on this.

I am working on a new feature in one of my applications that entails calling a long running process. I wrote the application to do it synchronously at first to make sure everything was working.

Then I installed/setup delayed_job, modified my controller to call @myobject.send_later :my_method and my call was now asynchronous.

Total time to convert from synchronous to asynchronous: < 15 minutes.

Thanks for the info. delayed_job is a great piece but its just an overkill for what i wanted. I wanted something simple - not just from an implementation standpoint - but resource too (not add any extra load etc).

"Keep in mind that each worker will check the database at least every 5 seconds."

For those who are interested, a solution was to use ruby system ('...&'). I fire it off (and forget) and let the OS mange it. (If needed, you can also manage the queues via ruby Process)