bikebike / BikeBike

Bike!Bike! website
https://bikebike.org
Other
8 stars 9 forks source link

The server takes too long to prime before sending out the first email #234

Closed G0dwin closed 7 years ago

G0dwin commented 7 years ago

Something is wrong with the server, it takes too long when it tries to send out the first email after re-starting. Because it take so long to send, responses which send emails time out and never complete the delivery.

The issue is somehow tied to the premailer gem, I think it may be taking a long time compiling assets or something.

We are currently working around the issue by always applying a delay which runs on the Sidekiq/Redis server which does not have a time out. It still take about 15 minutes before the email gets sent out but timely restarts and priming using our custom bundle exec rake deploy help to reduce the chance of users waiting too long for emails.

G0dwin commented 7 years ago

Solved! The problem was that we were not fully precompiling our assets. In our app config we had set:

config.assets.compile = true

Which caused assets to precompile before a process serves its first asset. Setting the value to false instead allows the first email to take very little time to cache as send.

We are delivering most email immediately except for mass emails and general notifications which are delivered to multiple users.