Asynchronous Actionmailer in Rails

后端 未结 2 1868
心在旅途
心在旅途 2021-01-07 09:31

I\'ve noticed some of my actions (on a development environment) take a little while to load up as an email they require an email notification (through Google\'s servers). D

2条回答
  •  醉话见心
    2021-01-07 10:06

    Offloading potentially long-running tasks such as sending emails in to the background is a good idea to improve the responsiveness of your application, albeit by sacrificing the simplicity of your application a little.

    One popular way to do this (which I have used with great success) is using Delayed Job. The README file contains examples of how simple it is to send email in the background -- basically you just use the send_later method.

    Here's a link to another good tutorial:

    http://railstips.org/2008/11/19/delayed-gratification-with-rails

提交回复
热议问题