Whenever a user sends another user a message, my app delivers an email notification to the recipient. Unfortunately, the email delivery process creates a short delay. Any thoughts on how to remove this delay? Would calling the delivery method with a after_filter be the right way to go? Thanks. Jesse -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Whenever a user sends another user a message, my app delivers an email > notification to the recipient. Unfortunately, the email delivery process > creates a short delay. Any thoughts on how to remove this delay? Would > calling the delivery method with a after_filter be the right way to go? > Thanks.The after_filter might mask the delay... I''ve never used it, but another option would be to store the message info in a table and process it with a background process out of cron every minute or so (or shoot it off to backgroundrb for processing)... -p --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/13/07, YJ <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Whenever a user sends another user a message, my app delivers an email > notification to the recipient. Unfortunately, the email delivery process > creates a short delay. Any thoughts on how to remove this delay? Would > calling the delivery method with a after_filter be the right way to go? > Thanks. >You can try this approach http://datanoise.com/articles/2006/7/14/asynchronous-email-delivery -- Kent --- http://www.datanoise.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The method of running a cron that often isn''t really a good idea, especially if you''re not running on top of the line hardware. It will load up the whole environment, execute that one tiny task and exit. What I''ve done in cases like this is write a long-running(read: infinite) class method that checks for the condition, executes its task and then waits 30 seconds or so. Yes, you still have an extra copy of the app in memory, but you''re not using up cpu and disk resources like you would loading everything up every minute. Jason Philip Hallstrom wrote:>> Whenever a user sends another user a message, my app delivers an email >> notification to the recipient. Unfortunately, the email delivery process >> creates a short delay. Any thoughts on how to remove this delay? Would >> calling the delivery method with a after_filter be the right way to go? >> Thanks. >> > > The after_filter might mask the delay... I''ve never used it, but another > option would be to store the message info in a table and process it with a > background process out of cron every minute or so (or shoot it off to > backgroundrb for processing)... > > -p > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Check out the observer class. It is tailor made for what you want to do. http://api.rubyonrails.org/classes/ActiveRecord/Observer.html -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
YJ wrote:> Whenever a user sends another user a message, my app delivers an email > notification to the recipient. Unfortunately, the email delivery process > creates a short delay. Any thoughts on how to remove this delay? Would > calling the delivery method with a after_filter be the right way to go? > Thanks. > > Jesse > >Hey YJ I wrote a short article on exactly this issue here: http://rails.co.za/articles/2006/10/30/sending-emails-in-the-background-with-actionmailer-and-backgroundrb It does as Philip stated right at the end of his reply... Cheers, Gustav Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chet, The observer class looks interesting, and I may use it in a project I''m working on, but I don''t think the situation I had could use Observer. Basically, the app is an Ebay-style auction site. I have lots which have an expiration time and a status. My daemon goes and queries the database for lots that are "Open" but whose end time has passed. If it finds one, it closes the lot, logs a purchase and sends emails to the buyer and seller. It is really clunky having an external process like that running, and a bit unreliable - the app could be running fine, but without the daemon, lots will never get properly closed and no one will get emails about them. If you know of any other way to implement something like this, I''d be happy to hear about it. Jason Chet wrote:> Check out the observer class. It is tailor made for what you want to do. > > http://api.rubyonrails.org/classes/ActiveRecord/Observer.html > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---