views:

991

answers:

1

I'm currently working on a simple CRUD application. One requirement is preventing users from editing things concurrently. In order to do this I "lock" records to see if they're being edited, to prevent other users from editing at the same time. I was thinking a good way of implementing this might be to use an AJAX keep-alive to see if the users session has expired and if so, then unlock the record for editing. Has anyone used this technique before? Will it work if the workstation has been locked for a few minutes or no?

+3  A: 

I would see this practice as being a bit tricky to implement, and potentially prone to errors.

Typically when I run into situations like this my clients have been ok with a method that when returining the update, the record is first checked for changes, THEN the update is committed, otherwise, they are presented with a merge operation.

My feeling with timeouts and keepalives are that so many things can happen that will prevent a quick unlock that for most users it is frustrating.

Mitchel Sellers