You're welcome.
On Friday, December 9, 2011 12:51:21 PM UTC-5, Cliff wrote: > > In real usage the likelihood is low. But I can't guarantee there will > never be a problem caused by network latency, either. > > I don't use file-based sessions because I have several applications > that work together, as in 'cooperating applications.' Though I > suppose I could have one repository for session files and softlink to > it. I'll have to read up on that. > > By the way, thanks. Your contributions here are a real benefit. I > bookmark a lot of them. > > On Dec 9, 11:58 am, Anthony <[email protected]> wrote: > > In real usage, is a user likely to be able to update the date field and > > then quickly click the view link so fast that the view query happens > before > > the update query? If so, then your client side feedback idea is probably > > the way to go. > > > > Actually, if both the update and view requests use the session (or > rather, > > do not do session.forget), and you are using file based sessions, then > the > > first request should block the second request until the first request > > completes. In that case, you could only get a race condition if the view > > request actually arrives at the server before the update request. > > > > Anthony > > > > > > > > > > > > > > > > On Friday, December 9, 2011 11:43:37 AM UTC-5, Cliff wrote: > > > > > The problem occurs in many-to-many relations, as in this example > > > model: > > > > > db.define_table('owners', Field('name')) > > > db.define_table('dogs', Field('name')) > > > db.define_table(dog_owners', > > > Field('owner_id', db.owners), > > > Field('dog_id', 'db.dogs'), > > > Field('date_owner_got_dog', 'date') #This is important! > > > ) > > > > > When an owner record is edited, I would also put on the page a table > > > of all dogs owned by the owner. With each dog there is a field for > > > editing date_owner_got_dog. The change event for that field triggers > > > a jQuery script. The script uses Ajax to tell the server to update > > > the value. > > > > > When an owner record is viewed, I would put up the same table without > > > capability to edit date_owner_got_dog. > > > > > Here is how to get the race condition: > > > 1. Open an owner record for editing. > > > 2. Update one of date_owner_got_dog fields. > > > 3. Quickly click the 'view' link. > > > 4. Observe old value in the updated field because the server fetched > > > the dog record before it was updated. > > > > > The server can fetch the owner and dog records before finishing the > > > update triggered by step 2. > > > > > I didn't see this in manual testing but Selenium found it right away. > > > > > I'm going to put up a 'please wait' flash message before kicking off > > > the ajax call and change it to a 'done' message when the server has > > > done its piece. > > > > > Anybody have any better ideas? > > > > > How does smartgrid handle this? > >

