Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To add onto Ben Doom's answer, I'm including some example code of a way this can be accomplished. There are multiple approaches and ways of names, organizing and calling the code below, but hopefully it is helpful.</p> <p>At some point during request start, store information about the process in shared scope and return an ID to the client. Here are example functions that could be used on page or remote requests.</p> <pre><code>&lt;cffunction name="createProcess" output="false"&gt; &lt;cfset var id = createUUID()&gt; &lt;cfset application.processInfo[id] = { progress = 0, kill = false }&gt; &lt;cfreturn id /&gt; &lt;/cffunction&gt; </code></pre> <p>Client can then check progress by polling server, or submit request to kill process</p> <pre><code>&lt;cffunction name="getProcessProgress" output="false"&gt; &lt;cfargument name="processID" required="true"&gt; &lt;cfreturn application.processInfo[arguments.processID].progress /&gt; &lt;/cffunction&gt; &lt;cffunction name="killProcess" output="false"&gt; &lt;cfargument name="processID" required="true"&gt; &lt;cfset application.processInfo[arguments.processID].kill = true /&gt; &lt;/cffunction&gt; </code></pre> <p>The actual server-side process in question can then hit a function, for example during a loop, to check whether it should abort processing and cleanup any work as appropriate.</p> <pre><code>&lt;cffunction name="shouldKillProcess" output="false"&gt; &lt;cfargument name="processID" required="true"&gt; &lt;cfreturn application.processInfo[arguments.processID].kill /&gt; &lt;/cffunction&gt; </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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