mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
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.
This commit is contained in:
@ -18,9 +18,7 @@ module Email
|
||||
style = if @message.html_part
|
||||
Email::Styles.new(@message.html_part.body.to_s, @opts)
|
||||
else
|
||||
unstyled = UserNotificationRenderer.with_view_paths(
|
||||
Rails.configuration.paths["app/views"]
|
||||
).render(
|
||||
unstyled = UserNotificationRenderer.instance.render(
|
||||
template: 'layouts/email_template',
|
||||
format: :html,
|
||||
locals: { html_body: PrettyText.cook(text).html_safe }
|
||||
|
Reference in New Issue
Block a user