[ic] academic discussion about inventory under high checkout concurrency

Mike Heins interchange-users@icdevgroup.org
Tue Oct 22 00:16:01 2002


Quoting Jeff Dafoe (jeff@badtz-maru.com):
> 
>     On a IC site with high checkout traffic it would also be necessary to
> modify the admin interface.  The current admin interface saves inventory
> modifications as absolute values.  If the inventory field indicates that you
> have six items and you just received six, you put "12" in the box.  This
> obviously wouldn't work on a site with crazy levels of checkout.  It would
> be necessary to modify the inventory adjustment code on the admin side to
> work on an adjustment basis, possibly storing the original inventory value
> as a hidden form field.  Then if an inventory update was necessary it could
> occur inside a db transaction where the current inventory value could be
> read and modified by the appropriate amount in one atomic operation.

You wouldn't do those types of updates live. In fact, it is doubtful
you should do inventory on IC at all, other than as an advisory...as I
have said many times, IC is not an accounting system and doesn't pretend
to be.

Any automatic inventory features have been put in by popular demand
and with me kicking and screaming....I have never pretended that they
were bulletproof.

That being said, there is an atomic increment of sorts in IC
with

    [data table=inventory col=qty key="the_sku" increment=1 value=6]

You would want to put the DB in transactions mode first, of course.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

Prove you aren't stupid.  Say NO to Passport.