We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d9bfc34 commit a1ab5bbCopy full SHA for a1ab5bb
examples/topics.rb
@@ -0,0 +1,31 @@
1
+#!/usr/bin/env ruby
2
+
3
+$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
5
+require 'async'
6
+require 'faraday'
7
+require 'async/http/faraday'
8
9
+# Async.logger.debug!
10
11
+module TestAsync
12
+ URL = 'https://www.google.com/search'
13
+ TOPICS = %W{ruby python lisp javascript cobol}
14
15
+ def self.fetch_topics_async
16
+ TOPICS.map do |topic|
17
+ Async do
18
+ Faraday.get("#{URL}?q=#{topic}")
19
+ end
20
+ end.map(&:wait)
21
22
+end
23
24
+Faraday.default_adapter = :async_http
25
26
+Async do
27
+ pp TestAsync.fetch_topics_async
28
+ensure
29
+ Faraday.default_connection.close
30
31
0 commit comments