Jos
Jos

Reputation: 1089

Ruby on Rails request in background

In my Ruby on Rails app, a user can grant me permission to tweet on their behalf, so they can send prefilled tweets from the application. This is the flow:

The request to twitter blocks my app. I use ActiveJob with resque for other communication with 3rd party applications and e-mail, but in this case I want to give the user response based on the twitter server response.

Is it possible to somehow do?:

It is not a problem that my user sending the tweet has to wait. I just do not want other users to wait on that.

Upvotes: 1

Views: 294

Answers (1)

Omar Mowafi
Omar Mowafi

Reputation: 854

One solution is to use ActiveJob and rescue to request from twitter and when twitter responds, you can use a realtime engine to respond back to the user.

Another solution is to use a server that supports multithreading (puma, rainbows!..).

I personally think that I would use a realtime service to solve this problem. Although it adds some overhead but on the long run it will help sustain a higher number of concurrent users.

Upvotes: 2

Related Questions