Mange/roadie-rails

inline erb .. or .. cache inlined output

Closed this issue · 5 comments

Hi,

I have a problem I use sidekiq to generate a lot of mails, which uses an immense load of memory!

Would it be possible to just inline css via maybe a rake task or command directly after deploy, so I don't need to on each mail send?

the output should be erb again, so the content could still change.

.. thanks a lot ..
Torsten

Mange commented

That would be very hard as we need a parser that can avoid looking at the
erb blocks and output then unchanged. In addition, it would make it
impossible to use helpers to generate tags, we would have to follow inside
partials and separate them into different partials as two mails with
different styles could use the same partial, and a bunch of other problems.

This is out of scope for this project.

Den tis 18 okt. 2016 00:57Torsten Wetzel notifications@github.com skrev:

Hi,

I have a problem I use sidekiq to generate a lot of mails, which uses an
immense load of memory!

Would it be possible to just inline css via maybe a rake task or command
directly after deploy, so I don't need to on each mail send?

the output should be erb again, so the content could still change.

.. thanks a lot ..
Torsten


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#67, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAGP4DcRey69wvJW0T1DjCpjEJ3350-ks5q0_1HgaJpZM4KZMyE
.

would be totally OK to just inline one view .. so i.e.: Roadie.inlineErb("/path/to/erb", {styles: "path/to/styles"}) .. than I could make a rake or helper task which inlines all views, partials and layouts .. so each single mail would be generated in no time

My Sidekiq-Job generates maybe about 100 mails per Job and is already way over 500 MB each time .. after some researching I realized roadie is the bottleneck there

Mange commented

You could build this manually using plain Roadie if you go with a template
engine that is parseable by an HTML parser, for example mustache.

I'd like to optimize memory usage if possible. Have you tried using simpler
stylesheets? It'd be great to get some optimizations going if you have a
good test case. ☺️

Den tis 18 okt. 2016 12:42Torsten Wetzel notifications@github.com skrev:

would be totally OK to just inline one view .. so i.e.: Roadie.inlineErb("/path/to/erb",
{styles: "path/to/styles"}) .. than I could make a rake or helper task
which inlines all views, partials and layouts .. so each single mail would
be generated in no time

My Sidekiq-Job generates maybe about 100 mails per Job and is already way
over 500 MB each time .. after some researching I realized roadie is the
bottleneck there


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
#67 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAGP1_cB3MU68WhGZlbczeLx-JSokCRks5q1KKDgaJpZM4KZMyE
.

Hey @Mange, sorry have to bother you again.

First of all thanks for the last reply, I took your suggestions:

  • simple css (7.5 kb)
  • higher memory for sidekiq (for huge operations even a single-worker-queue)

.. but the Problem appears again, now its way more than 1 GB mem used.
(The app is growing, so their may be a good 500+ mails per action)

I totally understand this is out of scope for roadie-rails .. so would give it a try myself.

Would you have some tips to start with .. I would like to have following features:

  • inline all styles in *_mailer folder on action x (deployment / bundle assets)
  • a config-file (which file uses which style .. additional helpers, templates)
  • keep erb tags untouched (maybe just allow a few tag-helpers .. ie: link_to, mail_to, image_tag .. and add a style: .. attribute )

And than wrap it together in a new gem like, roadie-piped or something

.. thanks a lot ..
cheers
Torsten

Mange commented