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

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.