Making multiple HTTP requests asynchronously

后端 未结 8 1168
傲寒
傲寒 2020-12-13 21:44
require \'net/http\'

urls = [
  {\'link\' => \'http://www.google.com/\'},
  {\'link\' => \'http://www.yandex.ru/\'},
  {\'link\' => \'http://www.baidu.com/\'}
]

ur         


        
8条回答
  •  暖寄归人
    2020-12-13 22:47

    It depends what you want to do after the function afterwards. You can do it with simple threads:

    see: http://snipplr.com/view/3966/simple-example-of-threading-in-ruby/

提交回复
热议问题