Skip to content

Instantly share code, notes, and snippets.

View steveluscher's full-sized avatar

Steven Luscher steveluscher

View GitHub Profile
/*
Eric Meyer's Reset Reloaded – SASS version
http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
# http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/b29b9ac9b43a5281
seconds_to_wait_for_lock = 5
begin
raise "Timed out while trying to acquire lock" unless connection.select_value("SELECT GET_LOCK('order_lock_for_product_#{@product.id}', #{seconds_to_wait_for_lock})") == "1"
# ... validate order availability ...
# ... create orders ...
rescue
# ... oh oh ...
# ... a stuck lock? ...