Forum OpenACS Q&A: Response to Thoughts on reworking double-click protection

Collapse
Posted by carl garland on
> What is broken that needs solving, here?

Double click protection is something that has implications that go beyond the ecommerce model and orders. I was hoping to come up with a more generic approach that might be used on registration pages, msg submission pages, etc. While the current implementation proposed by PG in http://www.arsdigita.com/books/panda/ecommerce of:

1.Serve user a dynamically generated order form that includes a unique order ID, pointing to an "insert-order" page.
2.When the user hits submit, the insert-order page will run and insert a row into a database table with a primary key constraint on the order id. If the insert fails (Oracle won't allow two rows with the same primary key), catch it and look to see if there is already an order in the database with the same id. If so, serve the user an order status page instead.
if the insert succeeded, proceed as above

This implementation could be extended but it does create and rely on querying dbs. In my ever attempt to adhere to DCIs attitude of avoiding DB querys as much as possible (ie aolserver tuning http://www.aolserver.com/documentation/tuning.adp
Beware the Database Databases are a bottleneck ) I think where possible it is desirable to move functionality out of the database and into the AOLserver process where it can be done in a reliable and efficient manner. I did not mean to imply that the current implementation blocks the thread of execution just that the new one wouldnt either.