<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 5.50.4807.2300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Exim itself should be the queue and processor shouldn't
it?</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=lenjaffe@jaffesystems.com href="mailto:lenjaffe@jaffesystems.com">Len
Jaffe</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=catalyst@lists.scsys.co.uk
href="mailto:catalyst@lists.scsys.co.uk">The elegant MVC web framework</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, December 04, 2015 8:48
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Catalyst] Sending 3000
emails.</DIV>
<DIV><BR></DIV>
<DIV dir=ltr><BR>
<DIV class=gmail_extra><BR>
<DIV class=gmail_quote>On Fri, Dec 4, 2015 at 2:04 PM, Andrew <SPAN
dir=ltr><<A target=_blank
href="mailto:catalystgroup@unitedgames.co.uk">catalystgroup@unitedgames.co.uk</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><U></U>
<DIV bgcolor="#ffffff">
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV dir=ltr>
<DIV class=gmail_extra>
<DIV class=gmail_quote><SPAN class="">
<DIV>If you're handing off the mail to exim, you're fine. Your
implementation is correct for your use case</DIV>
<DIV><FONT size=2></FONT> </DIV></SPAN>
<DIV><FONT size=2>---> Of course, I'm guessing I'm handing off to exim
- I should probably do something to
check!</FONT></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE>
<DIV>Look for Email::Sender configuration. It probably defaults to
sendmail, which is what you want.</DIV>
<DIV><BR> </DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV bgcolor="#ffffff">
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV dir=ltr>
<DIV class=gmail_extra>
<DIV class=gmail_quote><SPAN class="">
<DIV><FONT size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><FONT
size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><FONT
size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><FONT
size=2></FONT><BR></DIV>
<DIV>if the sign up for your service,</DIV>
<DIV>queue a "send them a welcome email" job,</DIV>
<DIV>and let the web request request return.</DIV>
<DIV> </DIV>
<DIV>Then a separate process:</DIV>
<DIV>sees that an email needs to be sent,</DIV></SPAN>
<DIV>generates the email,</DIV><SPAN class="">
<DIV>and hands it off to exim.</DIV><FONT size=2></FONT><FONT
size=2></FONT><FONT size=2></FONT><FONT size=2></FONT><FONT
size=2></FONT></SPAN></DIV>
<DIV class=gmail_quote> </DIV>
<DIV class=gmail_quote><FONT size=2>----> So what does the separate
process have to be? A process apart from my Catalyst app - like an
entirely different perl script that could be a cron job or something - or
can I return a response to the browser within my catalyst
subroutine, and then call a private catalyst subroutine to handle the
email sending?</FONT></DIV></DIV></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE>
<DIV>What triggers the sending of the 3000? </DIV>
<DIV><BR></DIV>
<DIV>I use a table as a queue, and I write a program that loops over the queue
until no more work to do:<BR></DIV>
<DIV>
<OL>
<LI> read the least-recently-processed job from the queue that has work
to do
<OL>
<LI>determine work-to-do as unassigned. (PID is null)</LI></OL>
<LI>mark it as assigned
<OL>
<LI>i keep a pid column and update the pid into the record</LI></OL>
<LI>do the work
<OL>
<LI>the whole job of some slice</LI></OL>
<LI>if done,
<OL>
<LI>perform post job bookkeeping</LI></OL>
<LI>else
<OL>
<LI>update in-progress status (num_complete)
<LI>update PID = NULL
<OL>
<LI>so the job processor can come back too it.</LI></OL></LI></OL></LI></OL>
<DIV><BR></DIV></DIV>
<DIV>I use this algorithm to send 500 emails at a time (in RoR). After 500,
the job goes to the end of the queue, and the next job is
processed. </DIV>
<DIV><BR></DIV>
<DIV>My processor is a stand-alone script that is run from cron.</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV> </DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV bgcolor="#ffffff">
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV dir=ltr>
<DIV class=gmail_extra>
<DIV class=gmail_quote>
<DIV><FONT size=2></FONT><FONT size=2></FONT><BR><FONT size=2>---> And
yes, after the quick fix, it wouldn't hurt to debug and see if there are
memory issues.</FONT></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE>
<DIV>That's the fun part. </DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV> </DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<DIV bgcolor="#ffffff">
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV dir=ltr>
<DIV class=gmail_extra>
<DIV class=gmail_quote>
<DIV><FONT
size=2></FONT></DIV></DIV></DIV></DIV></BLOCKQUOTE></DIV><BR>_______________________________________________<BR>List:
<A
href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</A><BR>Listinfo:
<A target=_blank
href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
rel=noreferrer>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</A><BR>Searchable
archive: <A target=_blank
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"
rel=noreferrer>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</A><BR>Dev
site: <A target=_blank href="http://dev.catalyst.perl.org/"
rel=noreferrer>http://dev.catalyst.perl.org/</A><BR><BR></BLOCKQUOTE></DIV><BR><BR
clear=all>
<DIV><BR></DIV>-- <BR>
<DIV class=gmail_signature>
<DIV dir=ltr>
<DIV>
<DIV dir=ltr>
<DIV>
<DIV dir=ltr>
<DIV>Len Jaffe - Information Technology Smoke Jumper - <A target=_blank
href="mailto:lenjaffe@jaffesystems.com">lenjaffe@jaffesystems.com</A> </DIV>
<DIV>614-404-4214 <A target=_blank
href="https://www.twitter.com/lenJaffe">@LenJaffe</A> <A target=_blank
href="http://www.lenjaffe.com/">www.lenjaffe.com</A><BR></DIV>
<DIV>Host of <A target=_blank
href="http://www.meetup.com/techlifecolumbus/">Code Jam Columbus</A> -
<A target=_blank
href="https://www.twitter.com/CodeJamCMH">@CodeJamCMH</A></DIV>
<DIV>
<DIV>Curator of <A target=_blank
href="http://www.lenjaffe.com/AdventPlanet/">Advent Planet</A> - An
Aggregation of Online Advent Calendars.
<DIV><BR></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>List:
Catalyst@lists.scsys.co.uk<BR>Listinfo:
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst<BR>Searchable
archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/<BR>Dev site:
http://dev.catalyst.perl.org/<BR></BLOCKQUOTE></BODY></HTML>