solidus

https://github.com/solidusio/solidus

Ruby

🛒 Solidus, the open-source eCommerce framework for industry trailblazers.

Spree::OrderMutex.with_lock!

Obtain a lock on an order, execute the supplied block and then release the lock.
Raise a LockFailed exception immediately if we cannot obtain the lock.
We raise instead of blocking to avoid tying up multiple server processes waiting for the lock.

Source | Google | Stack overflow

Edit

git clone [email protected]:solidusio/solidus.git

cd solidus

open core/app/models/spree/order_mutex.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Spree--OrderMutex-with_lock--for-pr


# Commit to git

git add core/app/models/spree/order_mutex.rbgit commit -m "better docs for Spree::OrderMutex.with_lock!"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Spree--OrderMutex-with_lock--for-pr

hub pull-request


# Celebrate!