discourse/app/services/user_notification_renderer.rb
Sam Saffron 71ea4ad7fc PERF: reuse renderer when rendering email templates
Previous to this fix we were leaking methods on the internal action view
template class per render.

This caused email generation to be very low and a steady memory leak in the
application in sidekiq when sending out emails

The behavior change is new to Rails 6 so this fix does not need to be
backported into stable.
2019-10-06 23:57:03 -04:00

14 lines
307 B
Ruby

# frozen_string_literal: true
class UserNotificationRenderer < ActionView::Base
include ApplicationHelper
include UserNotificationsHelper
include EmailHelper
def self.instance
@instance ||= UserNotificationRenderer.with_view_paths(
Rails.configuration.paths["app/views"]
)
end
end