zenphoto/zenphoto — pull request #48 by d4gurasu (2012-11-01 08:53:35+00:00)
Title: Image processing serialization with MySQL locks

Well sbillard said I'd have to show him code before he'd do anything. I see there is already something done in spite of all that. Would have been good to know, but anyway, here is what I did.

I think it has several advantages and its a good bit of work for me (not knowing php, html, or much of git) so I hope you consider it.

I hope I got this pull request right. Git seems great but way higher learning curve than svn.

Addedd Mysql Mutexe functions with option for flock locks

Features
MySQL locks are rmoved on connection termination and should be extremely portable. There are known
bugs in some versions and workarounds are included.
This might look heavy, but it's not as bad as it looks, AND I more than make up for the lost
milliseconds with seconds of gain, by leveraging the database to assing locks systematically
vs randomly. This will result in faster finishing time.
Options to control the concurrency and flock option are included as well as options
to control timeout limits while waiting (usually logest) and processing independantly.
The lock is placed inside the cacheImages function to avoid the possibility that future commits
unknowlingly bypass it.

Of cource the big point of MySQL locks is that they are more portable.