Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Sharing STDIN after fork

by talexb (Chancellor)
on Feb 13, 2022 at 17:46 UTC ( [id://11141363]=note: print w/replies, xml ) Need Help??


in reply to Sharing STDIN after fork

It seems like you are trying to cram a great deal of functionality into a single piece of code, and I'm not sure this is the easiest approach.

You could diversify by having one piece of code receive E-Mail requests from the CRM (or poll the CRM for outstanding requests), and add those to a database table. Another piece of code could look for unsent table entries, build the content (so that's where the template would get used), store the result back in the database table, send the E-Mail, and update the table with the result. Finally, a simple CGI could show the most recent table entries and their status (Not sent, Processing, Processed -- with link to text that was sent).

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Replies are listed 'Best First'.
Re^2: Sharing STDIN after fork
by Bod (Parson) on Feb 13, 2022 at 22:34 UTC
    It seems like you are trying to cram a great deal of functionality into a single piece of code

    Yes...having slept on it, I have sort of come to the same conclusion!

    I am definitely thinking that feeding the people that need an email into a database table is a better approach. That seems to give several advantages:

    • The list of emails to send doesn't get lost if there is some inturuption
    • People who are sent two different emails can have them automagically separated by a few hours
    • There's less for the sending script to contend with - it just picks the next address from the database and sends

      Great! This also follows the Unix philosophy, which is to have a variety of tools, each of which is excellent at doing one specific thing (with some obvious exceptions). Those tools can then be combined into a larger machine to complete a much more complicated task.

      Alex / talexb / Toronto

      Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

      Edit: Add the missing word 'complete' to the last sentence. Ugh.

        As it happens, today a new feature has been suggested that will necessitate holding the information in a database table - namely being able to schedule the email sending for some time in the future. So I will either be implementing it this way or perhaps using Minion as suggested by etj

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11141363]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-25 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found