@@ -153,7 +153,8 @@ until schedule_search.empty?
153153 next
154154 end
155155
156- schedule_search.push(result)
156+ puts " Re-queuing #{ search_id } "
157+ schedule_search.push(search_id)
157158end
158159
159160schedule_search.close
@@ -173,7 +174,7 @@ require 'connection_pool'
173174
174175# create a thread pool of 4 threads with a persistent connection to serpapi.com
175176pool = ConnectionPool .new (size: n, timeout: 5 ) do
176- SerpApi ::Client .new (engine: ' google' , api_key: ENV [' SERPAPI_KEY' ], timeout: 30 , persistent: true )
177+ SerpApi ::Client .new (engine: ' google' , api_key: ENV [' SERPAPI_KEY' ], timeout: 30 , persistent: true )
177178end
178179
179180# run user thread to search for your favorites coffee type
@@ -205,18 +206,19 @@ benchmark: (demo/demo_thread_pool.rb)
205206
206207``` ruby
207208require ' serpapi'
208-
209209require ' pp'
210210
211211client = SerpApi ::Client .new (api_key: ENV [' SERPAPI_KEY' ])
212212params = {
213213 q: ' coffee'
214214}
215215results = client.search(params)
216+
216217unless results[:organic_results ]
217- puts ' organic results found'
218+ puts ' no organic results found'
218219 exit 1
219220end
221+
220222pp results[:organic_results ]
221223puts ' done'
222224exit 0
@@ -253,7 +255,7 @@ it prints the first 3 locations matching Austin (Texas, Texas, Rochester)
253255]
254256```
255257
256- NOTE: api_key is not required for this endpoint.
258+ NOTE: ` api_key ` is not required for this endpoint.
257259
258260### Search Archive API
259261
0 commit comments