8 Replies Latest reply on Feb 14, 2008 4:42 AM by RichardG

    How on earth can I do this hour-plus process?

      We're doing email broadcasts which have begun to choke our outgoing smtp server so I need to send them out as smaller groups at fixed intervals. So 1,000 emails in batches of 100 every 10 minutes would take well over an hour which is fine for sending but NOT for the CF server!

      Obviously (right?) I can't have a process running this long on the server, so is there any other way to to this than having a scheduled task running every 10 minutes to check what's been sent etc etc?

      I've tried incrementing counters and cflocating a page back to itself after pausing with this code and it appears to work, but is this the best approach?:

      <cfif not isDefined("url.pass")>
      <cfset url.pass = 1>
      <cfset maxx = 4>
      <cfset pass = #url.pass# + 1>
      <cfset attributes.interval = 4>
      thread = createObject("java", "java.lang.Thread");
      thread.sleep(javaCast("long", 1000*attributes.interval));
      <cfif #pass# lt #maxx#>
      <cflocation url="untitled-5.cfm?pass=#pass#">

      Any comments would be greatly appreciated!