How to prevent Rails controller from hanging when making a web service call -
i have rails controller i'm calling when user loads specific page. controller makes call 3rd party web service. however, when web service down, rails controller hangs. i'm not able navigate page, log out, or refresh page...all of these tasks wait web service call complete before being executed. in event web service call never completes, have restart rails app in order functional again.
is there standard way of preventing happening? using faraday gem make web service calls. suppose set timeout value when making web service call. however, ideally user action of navigating page halt web service call immediately. possible?
i believe happening because using rack web implementation can handle 1 request @ time. unicorn event driven. node. should think fixing first timeout. if using faraday, can req.options.timeout = 5
have timeout.
then recommend using puma. if that's not option, should adjust server settings allow more 1 connection @ time. unicorn, believe worker_processes
.
Comments
Post a Comment