Posted by tobi — 10:31 AM Mar 06
Small plugin for using the global lock service of mysql in your rails app: Locking plugin
Great if you have long running cron tasks or require exclusive access to some resources.
Example:
Invoice.acquire_lock("Shopify billing") do
# Can only run once across your server farm
Invoice.find_all_due.each { |invoice| invoice.collect_payment! }
end

Nate 06 Mar 14:52
Oh nice. I was just in some dire need for this exact thing. The stars are aligned. Thanks man!
Tim Carey-Smith 06 Mar 21:12
Did you mean to misspell acquire?
tobi 08 Mar 13:35
thanks for pointing this out