"Coldfusion Web Server-Client to throttle down or pace processing (pseudo-cron)" was posted by nick and 1 user commented
mygif
dgurba said,
October 6 2007

Thats a really simple approach. I have a similar chunk of code I wrote in php.

Instead of hardcoding the values of: how much todo and where to start/finish. I have stored those values in a db table.

I also stored the “work to be done” in a seperate table which had a flag to say whether or not that row is completed.

Then the core of my cron-like-worker says: start wherever you didn’t finish last, and go upto MAX row skipping anything DONE. If things didn’t finish up last time, it grabs the first thing not finished and starts from there … and skips over finished stuff back to where the bulk of the work is.

Since I use a master “task table” (holds task_id, description, number of tasks completed in last run, number of tasks todo per run, last runtime) and a “task todo table” (holds the stuff that needs to be done). I can have many little tasks running every one and then.

I normally cron the master file that runs all this. But, in essence I have small php-driven cron jobs which my system admin doesn’t have to worry about. And the code is written in such a way as to never do more than XX rows at a time, per task.

Welcome. Please leave your comments below

  Username (required)

  Email (required)

  Website

You can leave your comments:

Comment Rss - TrackBack