zencoder/locker — pull request #1 by nate (2012-12-24 02:55:36+00:00)
Title: Use postgres exclusive row-level locks instead of update tricks.

Ruby thread scheduling is crappy, especially in 1.8, and especially w/ C exts.
In practice you end up getting locks stolen far too often. Instead we can use
postgres exclusive row-level locks to obtain a lock and the lock is maintained
so long as the connection is maintained and the transaction is still open. This
should be far more reliable than the previous version, but it allows less
insight into what is locked by what in the system. Future versions may maintain
a second, informational table about which process owns a lock and when it was
locked. This is necessary due to our need to keep a transaction open to keep
the lock, so any updates to the lock will not be visible to any other transaction.