• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Have to simulate Cfquery load times and cfflush isn't working!!! Thoughts?

Hey guys -
I have to build a interactive loading bar to show page loads while various cfquery scripts run.  My goal was to use cfflush to break up the queries and run a javascript to update the loading bar.  For whatever reason, the whole page is just churning and then running all of the code at the end.  Here's my script (nprogress is the loading bar function I'm using, start() starting it, inc() increasing it):

  <script>
    NProgress.start();
 </script>


 BLA BLA
 <cfflush>

 <BR><BR>adfajdlfkajsdflk
<cfquery datasource="MOLMS">
SELECT GETDATE() CurrentTime
WAITFOR DELAY '00:00:05' ---- 5 Second Delay
SELECT GETDATE() CurrentTime 
</cfquery>

 
  <script>

NProgress.inc();
 </script>

 <cfflush>
 
 
 <BR><BR>adfajdlfkajsdflk
<cfquery datasource="MOLMS">
SELECT GETDATE() CurrentTime
WAITFOR DELAY '00:00:05' ---- 5 Second Delay
SELECT GETDATE() CurrentTime 
</cfquery>


  <script>

NProgress.inc();
 </script>

Open in new window


Any thoughts on why cfflush isn't dumping data?  Obviously the queries are fake, but since the time delay is happening on the SQL side, this is more or less the exact way the page would load if it was real data.  


Thanks!!
0
milestonetech
Asked:
milestonetech
  • 3
1 Solution
 
dgrafxCommented:
try putting the following before your script & flush:

<cfoutput>#repeatString(" ", 73729)#</cfoutput>
<script>NProgress.inc();</script>
 <cfflush>
0
 
milestonetechAuthor Commented:
thanks for the response dgrafx, no luck man....
0
 
dgrafxCommented:
you should have some form of success
it may be your script NProgress.inc - i don't know what code you're using in it ...

here is a proof of concept

First run this:
<cfloop from="1" to="10" index="ii">
      #getTickCount()#<br /><br />
      <cfthread action="sleep" duration="100" />
      <CFFLUSH>
</cfloop>
</cfoutput>
Done
<CFABORT>

Then run this:
<cfloop from="1" to="10" index="ii">
      #getTickCount()#<br /><br />#repeatString(" ", 73729)#
      <cfthread action="sleep" duration="100" />
      <CFFLUSH>
</cfloop>
</cfoutput>
Done
<CFABORT>

The only difference is the use of repeatString which adds content so there is something to flush.
btw - the cfthread is acting as a time waster so as to test flushing.

let me know ...
0
 
dgrafxCommented:
Thanks for the points!

I'm hoping this was of value to you and you didn't just accept for general purposes ...

Good Luck!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now