Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ColdFusion 11 cfflush tag not working correctly?

Anyone having issues with the cfflush tag in ColdFusion 11? We have a routine that updates a live record count as it is processing a loop. In ColdFusion 10, this works fine. In ColdFusion 11, it waits until the end of the loop to update the screen. Not really what we expected.

Edited to add code as requested...

<script language="javascript">
    addOutputLine('<br /><span id="insertCount">Records Inserted: 0</span>')
</script>
<cfset insertCount = 0>
<cfset updateCountAfter = 1>
<cfif qry.recordcount gt 5000>
    <cfset updateCountAfter = 10>
</cfif>

<cfoutput query="qry" startrow="#DATASTART#">
    <!---do some stuff here that is not important to this issue--->

    <cfset insertCount = insertCount + 1>
    <cfif updateCountAfter gt 1>
        <cfif insertCount mod updateCountAfter eq 0>
            <script language="javascript">document.getElementById('insertCount').innerHTML = 'Records Inserted: #insertCount#';</script>    
        </cfif> 
    <cfelse>
         <script language="javascript">document.getElementById('insertCount').innerHTML = 'Records Inserted: #insertCount#';</script>
    </cfif>

    <cfflush>

</cfoutput>
like image 904
Casuzen Avatar asked Nov 24 '14 22:11

Casuzen


1 Answers

Promoted from the comments

There is a configuration setting that is necessary for the <cfflush> tag to work properly with the web server. On the Configuring web servers in Windows documentation page, under the Configure IIS for ColdFusion in Windows section, among other things it states:

To disable webserver buffer, change the is_buffer_enable [sic] to false in the cfroot\config\wsconfig\1\isapi_redirect.properties file. Disable webserver buffer if you want cfflush to work over an IIS connector. If your application does not use cfflush, set it to true for increase in the performance.

Note that there is a typo in the Adobe documentation that I referenced above. It should state iis_buffer_enable, not is_buffer_enable (missing an 'i'). Thanks to KrunchMuffin for pointing that out.

You will need to restart IIS for this change to take affect.

I'm not sure what the performance ramifications are of disabling this setting. You will need to do some load testing for your particular environment to see.

like image 135
Miguel-F Avatar answered Oct 07 '22 15:10

Miguel-F