• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Engaged ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

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

Any comments would be greatly appreciated!

Thanks,
Richard
TOPICS
Advanced techniques

Views

627

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Feb 13, 2008 Feb 13, 2008
cfchedule <smacking forehead!> I'd totally forgot about it. Very cool. I can schedule a task to run until it completes and then delete it when done. Perfect.

Thanks!!

Votes

Translate

Translate
Guest
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

Have you considered using CFSCHEDULE?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

cfchedule <smacking forehead!> I'd totally forgot about it. Very cool. I can schedule a task to run until it completes and then delete it when done. Perfect.

Thanks!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied


Just out of curiosity what cf server version are you using? We send out thousands of emails (using spooling) without much problem at all with MX 7.0.2.

Other than that I wouldn't do a cflocation back to yourself.

you can put the entire processing in a loop and make it go to sleep for 10 minutes until all the emails are sent instead.

This way you have one thread running and sleeping at 10 minute intervals but you will need to make sure that you have a way of determining if the email has been sent so you can start again if something bad happens 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

The probelm is I have to relay the email from the CF server out through our corporate email server and thats the one clogging up.

cfschedule looks perfect though.

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

RichardG,

IIRC there was a bug involving deleting scheduled tasks. I do not remember where I read it. You may want to do some searching first.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

I'll keep searching on this but all I could find regarding ver 7 is an esoteric bug regarding clustered servers.

There were bug complaints from earlier versions but so far so good. The proof will be in the testing once I get this going.

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Feb 13, 2008 Feb 13, 2008

Copy link to clipboard

Copied

I finally found it. The issue I read about was with tasks deleting themselves. It applied to MX6, but I do not know if it was ever fixed in MX7. Here are the links in case it applies to what you are doing.

Mike Schierberl's Blog: cfschedule delete - workaround (from google cache)
ColdFusion MX: Deleted scheduled tasks continue to run

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 14, 2008 Feb 14, 2008

Copy link to clipboard

Copied

LATEST
cfSearching -

That totally stinks!! It's the prefect solution. Well there's one way to find out, I will test the heck out of it and report back. Not today though as I woke with a bad back and am staying home.

Thanks so much for finding the reference, now I know what to look for - I really appreciate it!!

Richard

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation