[Catalyst] Duplicate entries with
C::P::Session::Store::DBIC and MySQL
list at funkreich.de
Tue Jul 29 13:00:46 BST 2008
Quoting Nigel Metheringham <nigel.metheringham at dev.intechnology.co.uk>:
> On 29 Jul 2008, at 12:30, Tobias Kremer wrote:
> > The short time window between the find() and create() calls of the
> > find_or_create() method indeed is the problem. It sounds like this
> > window
> > should be too small to ever happen but in reality it happens very
> > often in our
> > (and other's) applications. I can force the problem by hammering
> > reload in my
> > browser.
> Run the find_or_create within a transaction. You could even extend
> find_or_create to package it within a transaction if you wanted.
Yes, that'd be the optimal solution - unfortunately not every database in the
world has transactions. So, this doesn't help if you're using MySQL and a
MyISAM session table which really is not an exotic combination IMHO.
More information about the Catalyst