diff options
author | Henare Degan <henare.degan@gmail.com> | 2013-03-05 13:12:45 +1100 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2013-03-05 13:12:45 +1100 |
commit | b03451b6253b0c0ecd202b48f7a702b7e6844a90 (patch) | |
tree | 37706f313a2a2481993511d0787f2d09dad09db8 | |
parent | 4c440594e65c14c97808c14a73a477d8a6674d89 (diff) |
Workaround a Postgres connection error we are getting under Rails 3.1
-rw-r--r-- | vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb index e03c5e4aa..ccaa48bee 100644 --- a/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb +++ b/vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb @@ -717,8 +717,16 @@ module ActsAsXapian if not $?.success? raise "batch fork child failed, exiting also" end - # database connection doesn't survive a fork, rebuild it - ActiveRecord::Base.connection.reconnect! + + # FIXME: Under Rails 3.1 we get "SSL error: decryption failed or bad record mac", this works around it + retry_count = 0 + begin + # database connection doesn't survive a fork, rebuild it + ActiveRecord::Base.connection.reconnect! + rescue + retry_count += 1 + retry_count > 3 ? raise : retry + end else # fully reopen the database each time (with a new object) |