I would like to test a timeout handler for sql query longer than 5 seconds:
module ActiveRecord
module ConnectionAdapters
class PostgreSQLAdapter
def configure_connection_with_statement_timeout
configure_connection_without_statement_timeout
ActiveRecord::Base.logger.silence do
execute('SET statement_timeout = 5000')
end
end
alias_method_chain :configure_connection, :statement_timeout
end
end
end
But I don't know how to make such a slow sql query with Active Record.