joereger.com

something opinionated and awesome goes here


8
Month
2
Day
2004
Year
12
Hour
19
Minute
PM

The "Lost Post" Issue



This one drives me nuts. It's hard to solve. The problem is that when you spend over 20 minutes writing a post and then submit it you lose it. Some browsers allow you to go back and resubmit it. Others don't. It's a real pain in the ass because you've invested so much effort in an entry and then lose it because some assclown code monkey (i.e. me) didn't write good code.

The challenge is this tough.

I have to timeout sessions because otherwise memory allocation on the server goes too high. I have to look at traffic over the timeout period and make sure that I have enough memory to hold the required session objects for each user on the system. Set the timeout too high and the server comes crashing down. Set it too low and users lose their entries.

Dominic sent me an email about it last week. Mark sent one a few months ago. I spent a day this weekend working on it.

What I'd like to do is cache the request that fails login (the one just after timeout) and then restore it after you login. But this capability isn't available. When I put a javax.servlet.http.HTTPServletRequest object into the session it doesn't stay put across requests. Not cool. It's actually a redundancy issue... request is part of session is part of request is part of session. So the designers prevented the infinite loop.

But Tomcat's built-in authorization method is able to restore a request. I don't like to idea of tying the code to any app server vendor but I may have to. This is too big of an issue. I looked at it and I'd have to rework the entire authorization engine. I'll probably have to do this soon anyways to implement single sign-on SSO. But it's a lot of reworking.

Another idea that I've seen other blogging services use is copy-and-paste. When you click to make an entry they copy your entry into the clipboard without you knowing it. Then, if your session has timed out you can simply paste your entry. I like this but it may be hard to train users on... it may not be an obvious solution when they lose an entry.

Yet another idea is to have a little piece of javascript ping an image file every X minutes to keep the session alive. As long as you're on the page your session would be live. This scares the crap out of me though because if X users keep their browser windows open over night on the entry page then the server needs to keep that memory open even though they're not really using it.

So, there are fixes but none are as pretty as the one I wanted to implement. I'll get there. Sorry for the inconvenience. I lose entries every now and then and it really sucks.

These aren't excuses... I'll get a fix going asap.