asynchronous http request in ruby

后端 未结 3 1610
情深已故
情深已故 2020-12-05 17:51
 require \'net/http\'

urls = [
  {\'link\' => \'http://www.google.com/\'},
  {\'link\' => \'http://www.facebook.com/\'},
 {\'link\' => \'http://www.yahoo.c         


        
3条回答
  •  心在旅途
    2020-12-05 18:00

    Here is a great article covering the topic.

    Generally, viable alternatives to using threads for this would be the use of a Fiber or you could use em-http-request. In the latter example you could leave out the callback handling for your particular purpose.

提交回复
热议问题