ruby on rails - open-uri open command run on a domain, against the same domain -


ive built form on webpage allows user enter url , information url's css returned. tool works fine, apart 1 issue have noticed.

when enter url of site script hosted (tested locally, on staging server , on production server), open-uri command 'open' returns timeout::error. isn't hugely surprising, i'm guessing getting locked somewhere along line , in process of running script , opening current url, processes getting tied little.

for reference, here method timeout occurs:

 # loads nokogiri xml object if hasn't been loaded  def site    begin      timeout(10)        @site ||= nokogiri::html(open(url))      end    rescue timeout::error      return nil    end  end 

my question is, how enable script able 'open' domain script running on? need create thread or process particular aspect of tool, if how ensure rest of script isn't run until receive valid 'open' command?

thanks suggestions or tips on this.

i wonder if you're getting recursive loop. seeing repeated entries in httpd log showing requests same site?

if might want short-circuit requests particular domain , pre-stuff @site instance variable falls through.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -