How to solve long process rest API?

19 views
Skip to first unread message

Kengsreng Tang

unread,
Sep 23, 2015, 5:18:45 PM9/23/15
to rubyonra...@googlegroups.com
Let say we have a very long process API(it took more than 10s).

One solution was to make the process in background and return right
away, and we also need to create anther API to get_status whether the
process completed or still in progress.

I'm looking for a better solution.

--
Posted via http://www.ruby-forum.com/.

tamouse pontiki

unread,
Sep 24, 2015, 8:03:53 PM9/24/15
to rubyonra...@googlegroups.com
On Wed, Sep 23, 2015 at 4:18 PM, Kengsreng Tang <li...@ruby-forum.com> wrote:
> Let say we have a very long process API(it took more than 10s).
>
> One solution was to make the process in background and return right
> away, and we also need to create anther API to get_status whether the
> process completed or still in progress.
>
> I'm looking for a better solution.

I don't know if this will be better, and I'm just thinking out loud here, but:

If you use an AJAX request from the client (browser) to your
application, it can launch the task and then, again client-side, you
can resolve the promise when that task completes. If you don't want
the user to move to a different page during that time, you could run a
spinner while it completes.


Reply all
Reply to author
Forward
0 new messages