Skip to content

Commit

Permalink
Rescue all memcached errors, if the memcached servers are down we sho…
Browse files Browse the repository at this point in the history
…uld just fall back to the db, not hose the site
  • Loading branch information
stopdropandrew committed Oct 13, 2008
1 parent cc6dbb9 commit 73aff50
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/interlock/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def lock(key, lock_expiry = 30, retries = 5)
# Nil is a successful response for Memcached, so we'll simulate the MemCache
# API.
response ||= "STORED\r\n"
rescue Memcached::Errors
# if memcached raises one of these errors, lets assume the servers down
return nil
rescue Object => e
# Catch exceptions from Memcached without setting response.
end
Expand Down

0 comments on commit 73aff50

Please sign in to comment.