Note that there are some explanatory texts on larger screens.

plurals
  1. POPolling for status of sequential API calls
    primarykey
    data
    text
    <p>I am building an application which is a simple form. You place queries in a number of form elements and click submit. </p> <p>This submits a (fairly) large number of API calls to a 3rd party API to create the necessary objects in the third party app, perform them, then return the results to my app. </p> <p>The process takes 5-30 seconds. </p> <p>What I want this to do is render the results in a partial (think SQL IDE, like SSMS or TOAD or whatever - input at top, returns results below). And i would like this partial to refresh after each step in the process and display the status of the task to the user. Currently the app just sits and spins until all of this complex and IO heavy business logic is complete, which is resulting in horrible user experience. </p> <p>So, lets say the steps taken through the 3rd party API are:</p> <ol> <li><p>create widget</p></li> <li><p>start widget</p></li> <li><p>monitor widget status</p></li> <li><p>When complete, return final results to user. </p></li> </ol> <p>What I want to do is have a variable, say @status, which contains the current execution of the above process. "Creating Widget..." etc etc. This displays to the user as the tasks complete.</p> <p>How could i re-render the partial whenever one of these tasks are complete? Should it poll the server? And how would I go about polling a process running serverside without the thread locking until the above steps are complete? </p> <p>Currently, this is not written to a database, and I would like to keep the database out of this as much as possible due to load restrictions. </p> <p>Now, I am aware of different methods of polling to an action (AJAX through jquery), primarily using setinterval/timeout to make calls to a controller action and re-render, but If my API call methods are referenced in that action, it simply waits until it is all done anyway. </p> <p>Any thoughts? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload