mirror of
https://github.com/discourse/discourse.git
synced 2026-09-05 04:40:41 -05:00
Guard ActionRecord::Base.exec_sql against a readonly PostgreSQL cluster.
This commit is contained in:
@@ -5,6 +5,8 @@ class ActiveRecord::Base
|
||||
conn = ActiveRecord::Base.connection
|
||||
sql = ActiveRecord::Base.send(:sanitize_sql_array, args)
|
||||
conn.raw_connection.exec(sql)
|
||||
rescue PG::ReadOnlySqlTransaction
|
||||
Rails.logger.warn("WARN: PostgreSQL is in a readonly state. Performed a noop")
|
||||
end
|
||||
|
||||
def self.exec_sql_row_count(*args)
|
||||
|
||||
Reference in New Issue
Block a user