Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an async POST request in Ruby using RestClient

Can we make an asynchronous POST request to a resource in Ruby using the RestClient library ( https://github.com/archiloque/rest-client )?

like image 958
Kalyan Maddu Avatar asked Mar 01 '12 21:03

Kalyan Maddu


1 Answers

If by "asyncronous POST request" you mean "fire-and-forget" kind of request, then you can execute it on another thread.

Thread.new do
  # do your request here
end

Note, however, that not all Ruby implementations use real concurrent threads. See this topic for more details.

like image 110
Sergio Tulentsev Avatar answered Oct 20 '22 10:10

Sergio Tulentsev