Alan's supervisor forwarded him a curious ticket - a recently hired employee was training on how to use the customer profile web page and the new user felt that that the countdown timer on the page wasn't behaving quite right.

What made the issue so curious? The 6 year old, internally produced site was used by tons of people day in and day out to support the business - heck, even Alan had used it briefly during his testing.

No way would a problem like this exist in such a widely used page...or could it? He opened the page and watched the counter tick down. Sure enough, the newbie was right - the timer was behaving strangely.

Alan viewed the source to hopefully get to the bottom of things, but in the end, he got more than he bargained for.

//Shows a stopwatch in the status bar
var msec=0
var sec=59
var min=39
function start()
{
go=setTimeout("start()",1)
self.status=min+":"+sec
msec++
if(msec==100)
{
msec=0
sec--
}
if(sec==0)
{
sec=59
min--
}
if (min==5)
	{   stop()
    	min=40 	
    	alert("Please save your work, you may experience work loss if it is not save in next 5 mins ")
	}
}
function stop()
{
clearTimeout(go)
}
function reset()
{
window.location.reload()
}
window.onload = start;

Alan watched the timer as he skimmed through the JavaScript. 5...4...3...2...1...59... Where’d zero go?! he nearly thought out loud.

Needless to say, this Alan felt that this wasn't right - he needed to find the original developer and get some answers on this. However, after speaking to the developer, Alan learned that it wasn't much of a big deal. In fact, the developer was aware of the problems.

"Oh yeah, we knew early on that the countdown was buggy and changed depending on the speed of the user’s computer," the developer explained, "but it did the job."

"You see, early on, there was a bunch of deadlocking as it gained more widespread use. So, to make sure that users kept their time to a minimum, I added a sense of urgency in the form of a timer and a warning to save soon or else"

Alan still felt uneasy. "What about the 40 minute countdown...that seems a little excessive, don’t you think?."

The developer shrugged. "I just picked a number and figured I could lower it if I had to. Besides, it doesn't matter. By the time I fixed the deadlock problem the users got used to the timer, so I figured I’d leave well enough alone."

After hearing the great oral history of the customer profile page, Alan closed the ticket citing "known defect - to be fixed in future version", hoping that the user wouldn't reopen the issue requesting a slower PC.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!