How do I handle long requests for a Rails App so other users are not delayed too much?

后端 未结 3 975
醉梦人生
醉梦人生 2021-01-26 02:43

I have a Rails app on a free tier on Heroku and it recently started getting some users. One of the events in my app involves querying another API and can take up to 10 seconds t

3条回答
  •  面向向阳花
    2021-01-26 03:10

    That sounds like a Delayed Job situation. If the first request is just waiting, the most efficient thing to do is assign a process to wait for it to complete and cut the Rails process loose to handle another request.

提交回复
热议问题