简体   繁体   中英

Alternative to background jobs in rails

I'm watching series of railscasts dedicated to background jobs (delayed_job/resque/sidekiq etc). In several episodes Ryan uses request to external webservice as example of long running task. Web services are unpredictable and sometimes could answer with big delay or even be unavailable, but 90% is that modern web service would answer quickly, and time, consumed on job enqueuing would be longer than having no job (I think). So my question is there any light alternatives to jobs in processing probably long requests and not blocking UI? Obligatory condition is that request logic is incapsulated in ruby class and could not be implemented in simple ajax request.

You can use HTTParty (httparty gem) for inline requests. See https://github.com/jnunemaker/httparty

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM