cfinvoke execution order

210 views Asked by At

I have a cfinvoke which writes to a table like 200,000 records. Then I have a another cfinvoke writes about the 100,000 records to the same table.

I'm wondering how will this be executed?

  • Would cfinvoke execute first then once done, execute cfinvoke 2? OR
  • would cfinvoke 1 and 2 execute simultaneously in the background, continue with the rest of the page, even before either one of the executions are done?

P.S, cfinvoke 2 is NOT depended of cfinvoke 1, but I prefer them to execute one after another.

Any suggestions of making option 2 happen is greatly appreciated.

2

There are 2 answers

1
Henry On BEST ANSWER

If the 2 <cfinvoke>'s are invoked in the same request, back-to-back, without use <cfthread> then "cfinvoke execute first then once done, execute cfinvoke 2"

however, if you click refresh before the request is completed, and you're not using any sort of <cflock>, the records from 2nd request might intermingled with your 1st request.

0
Tomalak On

A ColdFusion template runs in a single-threaded and synchronous manner. Statements execute one after another, each statement takes as long as it needs. <cfinvoke> is no exception.