Up on the Roof…uh

a technology blog and more

Search




4
Oct

Coldfusion Web Server-Client to throttle down or pace processing (pseudo-cron)

Posted by: nick
in Coldfusion, Web Development

Today I wrote a small piece of code that I have wanted to use for some time now. I would rather have had found and ripped this code off of someone else online using a Google search, but either I wasn’t entering in the right phrases or no one has made their code easy enough to find.

Enough with the suspense already. I needed to run a bunch of SQL updates, but I didn’t want to tie up the system, so I was looking to, for lack of a better description, “pace” the batch processing. When looking at it, its admittedly simple, but I had a mental block trying to do this exclusively in coldfusion. This solution is a mix of CF and plain old web server plus web client.

Sure, I could have used cron, but this was a small job, and not worth the hassle for me. I’m sure someone has done similar before, but for those who are endlessly searching for this, like I had been, here you go. Also, I imagine many will have alternative methods or suggestions on improving this, please share with us and comment.

<cfparam name="start" default="1"> <!--- start with 1 --->
<cfparam name="next" default="0"> <!--- start with next as zero --->
<cfparam name="wait" default="60"> <!--- change the duration of the page refresh --->
<cfset start = next + 1> <!--- the counter --->
<cfif start eq 3> Done. <cfabort></cfif> <!--- puts an end to the refreshing --->
<html>
<head>
<title>Batch process</title>
<!--- this will use the parameters above and/or from the URL you enter to change the refreshing
in this case, I named the file "pace-batch-process.cfm" --->
<cfoutput>
<meta HTTP-EQUIV="refresh" content="#wait#;URL=http://www.yourdomain.com/pace-batch-process.cfm?next=#start#&wait=#wait#">
</cfoutput>
</head>
<body>
<cfif start eq 1>
Run the first thing
</cfif>
<cfelseif start eq 2>
Do the second thing
<cfelseif start eq 3>
Run the third thing
<cfelse>
Do nothing
</cfif>
</body>
</html>

Again, I imagine many will have suggestions on this, both positive and negative, please share and comment.

1 comment

Subscribe

  • Posts | Comments
  • Add to Google
  • Add to My Yahoo!
  • Subscribe with Bloglines
  • Add to Technorati Favorites
  • Add to netvibes
  • Add to My Rojo
  • Subscribe with NewsGator
  • Add to My AOL
  • Add to Windows Live Favorites
  • Add to My MSN

Recent Posts

  • This blog is one-year old
  • Government Caught Leaving Millions of Dollars Along Roadsides
  • The economic stimulus package. Can I have that in Chinese Yuan?
  • Comcast begins blocking customers legitimate emails
  • the problem with iChat…my face

Blogroll

  • Claudi’s Blog
  • Cool for Moms and Dads
  • Gab’s Blog
  • Medical News
  • Two Wheels Good
  • Words Pictures Web

Categories

  • Blackberry
  • Coldfusion
  • Communication
  • Economy
  • Email
  • Gadgets
  • hardware
  • Introduction
  • iPhone
  • ISP
  • Leopard
  • MacOSX
  • Organization
  • Photography
  • Reviews
  • security
  • Software
  • Technology
  • Uncategorized
  • Wallpaper
  • Web Development
  • Wordpress

Up on the Roof…uh is proudly powered by WordPress Designed by Ebay Business

rss