I have a page where a query resultset of various documents to be emailed or 
faxed to clients is being looped over. These can take up to 10 seconds to 
process, so I flush the progress to the browser so the user can see that 
document x of y total has been sent (or has failed). Y is usually 200, and 
never more than that.

This is infrequent, but sometimes the flush just stops flushing to the browser 
during a random iteration in the loop, even though the process is still running 
in the background and runs all the way to completion. I'm using CF8, viewing on 
IE9 (I have also viewed on IE8; I have yet to see this happen using IE8. So far 
has only happened on IE9).

I use divs to mimic table rows, as IE will not flush actual table rows one at a 
time; it waits until the whole table is done and only then renders it to the 
screen. I also set a very low interval so it doesn't wait too long before 
flushing the next bit of html. My code basically looks like this (btw - I 
didn't see any tags to enclode a codeblock; will try to keep this neat...):

<cfset objDocSender = createObject(some cfc)>

<cfflush interval=10>
<cfoutput>
   Processing documents...#repeatString(" ", 100000)#  <!---this to force IE to 
render--->
</cfoutput>

<cfoutput>
   <div id="row">
      <div id="cell" class="header">Work Request ID</div><div id="cell" 
class="header">Delivery Method</div><div id="cell" 
class="header">Success</div><div id="cell" class="header">Progress</div>
   </div>
</cfoutput>

<cfloop query="qryDocsToSend">
   <cftry>
      <cfset blnSuccess['#qryDocsToSend.DocID[currentrow]#'] = 
objDocSender.sendDocument(#qryDocsToSend.DocID[currentrow]#, 
'#qryDocsToSend.Delivery_Method[currentrow]#')>
      <cfcatch>
         <cfset blnSuccess['#qryDocsToSend.DocID[currentrow]#'] = false>
      </cfcatch>
   </cftry>
 
   <cfoutput>
      <div id="row"<cfif NOT blnSuccess['#qryDocsToSend.DocID[currentrow]#']> 
class="red"</cfif>>
         <div id="cell">#qryDocsToSend.DocID[currentrow]#</div><div 
id="cell">#qryDocsToSend.Delivery_Method[currentrow]#</div><div id="cell"><cfif 
blnSuccess['#qryDocsToSend.DocID[currentrow]#']>Y<cfelse>N</cfif></div><div 
id="cell">#qryDocsToSend.currentrow# of #qryDocsToSend.recordcount# 
processed.</div>
      </div>
   </cfoutput>

   <cfif blnSuccess['#qryDocsToSend.DocID[currentrow]#'] NEQ true>
      <cfset intNumFailed = intNumFailed + 1>
      <cfset lstFailedIDs = listAppend(lstFailedIDs, 
'#qryDocsToSend.DocID[currentrow]#')>
   </cfif>
</cfloop>

<cfoutput>
   <br>
   <div style="clear:both;">
      <br>#qryWRsToSend.recordcount - IntNumFailed# record<cfif 
qryWRsToSend.recordcount - IntNumFailed NEQ 1>s were<cfelse> was</cfif> 
sent.<br>
      <cfif intNumFailed GT 0>
         #IntNumFailed# failed.<br>
      </cfif>
   </div>
</cfoutput>


Has anyone else experienced this kind of behavior with cfflush?

Thanks,
Christophe

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355865
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to