Not a title you’d typically expect for a Lotus-geek related post, but I’m using it for good reason. A couple years ago I came up with this org chart hierarchy database that would create a visual representation of a person in the address book, showing their manager, their peers, and their subordinates, all based on the manager field in the person document. Our address book has some 25,000 documents in it, so the key was that all the relationships for each person needed to be calculated ahead of time so that we were essentially just displaying the document for the person being viewed at that moment. The logic wasn’t that difficult, but to handle both manager and name changes that might occur on a daily basis and update everyone’s document, it seemed that the best course of action to take was to wipe out the database and rebuild it every night. This worked fine… except that it usually took about 3-4 hours to run and occasionally failed. Not an easy agent to run in the middle of the day and expect to get any results in a timely manner.
So, while at Lotusphere this year, I talked to a developer in one of the labs about suggestions on rewriting it. He said that doing a comparison between the org chart document and their person document would be a lot faster than wiping the whole thing out and rebuilding it. So I put that project on my to-do list and it promptly got buried by a number of other things.
Well, last week the old org chart agent started failing more frequently, and we were tossing around some stopgap measures to fix it, when I decided that it wasn’t worth spending any more time on the old bastard and I was going to rewrite it. I struggled a bit with some of the logic to try and capture all the possible changes, but after three days of reprogramming and testing, my sinner agent has been reformed! Now, the initial building still takes about 2.5 – 3 hours, but the daily updates only take between 15 – 30 minutes! And since the database isn’t being wiped out every time, you can continue to use the org chart while updates are being made.
When I told my customer that the agent was born-again, their response was, “Hallelujah!”